76 Matching Annotations
  1. Feb 2024
  2. Sep 2023
    1. def self.make_lazy(*methods) methods.each do |method| define_method method do |*args, &block| lazy.public_send(method, *args, &block) end end end
  3. Jul 2023
    1. ```js // Getting details on a Threads user and outputting it to the console

      const getUserDetails = async (username) => { let userInfo = await threads.getUserData(username); console.log( "", Name: ${userInfo.full_name}\n, Bio: ${userInfo.biography}\n, ID: ${userInfo.user_id}\n, Followers: ${userInfo.follower_count}\n, Website: ${userInfo.bio_links[0].url} ); } getUserDetails("Gisgar3"); ```

  4. Nov 2022
  5. Sep 2022
    1. Shims are just tiny wrappers created by asdf that just forward execution to the real versioned executables installed by asdf. This way, asdf has a single shims directory added to your PATH and has no need of mangling the PATH for every installed version.
  6. Jan 2022
    1. const originalUnhandledRejection = window.onunhandledrejection; window.onunhandledrejection = (e) => { console.log('we got exception, but the app has crashed', e); // or do Sentry.captureException(e); originalUnhandledRejection(e); }
  7. Oct 2021
    1. const fetchWithJSONHeaders = applyDefaults(fetch, { headers: { "Content-Type": "application/json" } }); const fetchWithTextHeaders = applyDefaults(fetch, { headers: { "Content-Type": "application/text" } }); // Fetch JSON content const response = await fetchWithJSONHeaders("/users", { method: "GET" });
    1. But there is a lot of things we didn’t handle: How do we pass function arguments through? How do we maintain scope (the value of this)? How do we get the return value? What if an error happens?
    1. A wrapper function is a design concept where a very minimal function is using another function to do it's "work" for it, sometimes using a slightly different set of arguments.
  8. Sep 2021
    1. I think it's very confusing to overload common executables, such as yarn, in the /bin directory as I often put that bin directory first in my path. Thus, I'd unexpectedly get the bin/yarn rather than my system yarn, which I manage with yvm.
  9. May 2021
    1. This function runs on every request, for both pages and endpoints, and determines the response. It receives the request object and a function called resolve, which invokes SvelteKit's router and generates a response accordingly.
  10. Apr 2021
    1. Lumberjack 1.0 had a concept of a unit of work id that could be used to tie log messages together. This has been replaced by tags. There is still an implementation of Lumberjack.unit_of_work, but it is just a wrapper on the tag implementation.
    1. empty is an utility that provides an interface to execute and/or interact with processes under pseudo-terminal sessions (PTYs). This tool is definitely useful in programming of shell scripts designed to communicate with interactive programs like telnet, ssh, ftp, etc.
  11. Mar 2021
  12. Feb 2021
    1. # Set the model name to change the field names generated by the Rails form helpers def self.model_name=(name) @_model_name = ActiveModel::Name.new(self, nil, name) end
    1. def self.attribute(name, type = ActiveModel::Type::Value.new, **options) super attribute_type = attribute_types[name.to_s] # Add the ? method for boolean attributes alias_boolean(name) if attribute_type.is_a?(ActiveModel::Type::Boolean) # store date attribute names so we can merge the params during # initialization date_attributes << name if attribute_type.class.in?(DATE_TYPES) end
  13. Jan 2021
    1. Maybe $$slots like $$props? My use case is that I'd like to wrap a slot's content in an element that applies styling that I'd like absent without the slotted content. Something like this: {#if $$slots.description} <div class="description"> <slot name="description"></slot> </div> {/if}
    1. The extra div soup is two fold:
    2. (this issue)
    3. A component reserving a slot but needing to perform manipulation on its content dom reference will need to add an extra element wrapper on the receiving site (some people mention it here: #2106).
    4. A big app will have lots of components compared to regular html elements and these need to be wrapped before being fed to a slot, every single time on the call site
    5. I think this is very important feature to implement. Because for now we need to wrap target components by useless wrapper nodes.
    1. I want to make some add-ons or wrappers on components e.g BigButton.svelte <script> import Button from './Button.svelte' </script> <Button fz="16" h="64" {...$$props}> <slot slot="prepend" name="prepend" /> <slot /> <slot slot="append" name="append" /> </Button>
    2. Related to #1824, can do <svelte:component this={Bar}> <slot></slot> <slot name="header" slot="header"></slot> </svelte:component> <script> import Bar from './Bar.svelte'; </script> as a forwarding workaround
    1. Popper for Svelte with actions, no wrapper components or component bindings required! Other Popper libraries for Svelte (including the official @popperjs/svelte library) use a wrapper component that takes the required DOM elements as props. Not only does this require multiple bind:this, you also have to pollute your script tag with multiple DOM references. We can do better with Svelte actions!
  14. Dec 2020
    1. class Session extends Map { set(id, value) { if (typeof value === 'object') value = JSON.stringify(value); sessionStorage.setItem(id, value); } get(id) { const value = sessionStorage.getItem(id); try { return JSON.parse(value); } catch (e) { return value; } } }
  15. Nov 2020
    1. Capacitor is a framework that provides developers a coherent API set to access various features on different platforms. By doing so, it also simplifies using those features. Especially for web APIs that are hard to use or require multiple steps to set them up, Capacitor provides an easy-to-use interface.
    1. Embedding Svelte inside Angular is pretty easy, for the most part. I wrote a function that would take in a Svelte component and generate an Angular controller class.
    1. This is Sass based, and therefore doesn't require Svelte components

      Just because we could make Svelte wrapper components for each Material typography [thing], doesn't mean we should.

      Compare:

      • material-ui [react] did make wrapper components for typography.

        • But why did they? Is there a technical reason why they couldn't just do what svelte-material-ui did (as in, something technical that Svelte empowers/allows?), or did they just not consider it?
      • svelte-material-ui did not.

        • And they were probably wise to not do so. Just reuse the existing work from the Material team so that there's less work for you to keep in sync and less chance of divergence.
    1. It won't work in all use cases, but it's better than the div soup.
    2. I run into this on almost every project and end up doing this as a workaround: :global([slot="content"]) This allows me to style that extra div in the component that contains the slots but it would be super nice to have <MyComponent slot="content"/> and eliminate that extra div
    3. If this is getting implemented, I think I'll love to see both implemented. I can see a lot of use cases where I would like to encapsulate the component with additional wrappers and in another scenarios I would like to just use the component. Now i work around this using empty div but then at times it breaks the structure because of the div element and I'll have to add more class utilities to make it work. This will be a great addition for Svelte.
    4. I don't like adding unnecessary divs.
  16. Oct 2020
    1. Probably wouldn't work for capybara-based tests where it forks a different process for the web server?

    1. const store = readable(machine.initialState, set => { service.subscribe(state => { if (state.changed) set(state) }) service.start() return () => { service.stop() } })
    2. The readable store takes a function as a second argument which has its own internal set method, allowing us to wrap any api, like Xstate or Redux that has its own built in sub­scrip­tion model but with a slightly different api.
  17. Sep 2020
    1. Is there a good way to do this given the compiler won't know at build time what events are needed? Should I make a wrapper that does addEventListener myself with a bind:this? Would be nice if Svelte could handle dynamic events though.
    1. The primary motivation for this change is to have the same behavior between dom elements and wrapper components. Class directives are extremely convenient but that convenience is lost when a section of code needs to be converted to a component.
    2. This is especially useful for components that are a simple wrapper around a dom element.
  18. Jul 2020
  19. Jun 2020
  20. May 2020
  21. Apr 2020
  22. Feb 2020
  23. Jan 2020
  24. Nov 2019
  25. Sep 2019
    1. This version of Field is a thin wrapper over the official Field component, and the only Field API that this library uses/overrides is the field-level validate prop, so even if you are using this library's Field component, you will still get improvements as features are added to the React Final Form library in the future.
  26. Aug 2019
  27. May 2015
    1. if the client is incapable of working with HTTP headers

      OK... So in fact the wrapper I am implementing for recs ecommerce API is overkill - it is redundant with http. I'll keep it though, since I like to define my own error codes.