25 Matching Annotations
  1. Sep 2024
    1. mount IndexController do # all methods will be mounted automatically, it's just an example of refinement get '/hello', :hello_world end
  2. Dec 2023
  3. Dec 2022
    1. Dilemma: Do I use this unofficial library with its really nice idiomatic API or the official library (https://github.com/mailgun/mailgun-ruby) with its inferior API?

      I wish this one was still/better maintained because I'd much rather use this API, like: @mailgun.lists.create "devs@your.mailgun.domain" @mailgun.lists.list @mailgun.lists.find "devs@your.mailgun.domain"

      but it's not maintained, and looks like it doesn't have the word events in the source at all, so it's missing any way to use the Events API. :(

  4. Aug 2022
    1. you can also replicate the bind:this syntax if you please: Wrapper.svelte <script> let root export { root as this } </script> <div bind:this={root} />

      This lets the caller use it like this: <Wrapper bind:this={root} />

      in the same way we can already do this with elements: <div bind:this=

  5. Nov 2021
  6. May 2021
  7. Apr 2021
    1. logger.tag_formatter.default(Lumberjack::Formatter.new.clear.add(Object, :inspect)) logger.tag_formatter.default(Lumberjack::Formatter::InspectFormatter.new) logger.tag_formatter.default { |value| value.inspect }
    2. There are several built in classes you can add as formatters. You can use a symbol to reference built in formatters. logger.formatter.add(Hash, :pretty_print) # use the Formatter::PrettyPrintFormatter for all Hashes logger.formatter.add(Hash, Lumberjack::Formatter::PrettyPrintFormatter.new) # alternative using a formatter instance
    3. # This will register formatters only on specific tag names logger.tag_formatter.add(:thread) { |thread| "Thread(#{thread.name})" } logger.tag_formatter.add(:current_user, Lumberjack::Formatter::IdFormatter.new)
  8. Mar 2021
    1. var md = require('markdown-it')('commonmark');

      first sighting: require(...)(...)

      How would that work with import? Not as fluidly but...

      import markdownIt from 'markdown-it'
      let md = markdownIt('commonmark')
      
  9. Feb 2021
    1. Subprocess will try to match the nested ends’ semantics to the tracks it knows. You may wire custom ends using Output.
    1. I agre with your concern. I realy prefer to do this : form.assign_attributes(hash) if form.valid? my_service.update(form) #render something else #render somthing else end It looks more like a normal controller.
    1. Finally, you can use fields_for in order to create/edit associated fields and the suffix _list (like profile_list below) to choose an existing associated record.
    2. @user_form = UserForm.new(User.find(params[:id])) # you need to load the record being edited
    3. # Use relationship's name followed by "__" plus attribute's name # to validate has_one and belongs_to associations validates :name, :address__street, :company__name, presence: true
  10. Dec 2020
    1. page is a { host, path, params, query } object where host is the URL's host, path is its pathname, params is derived from path and the route filename, and query is an object of values in the query string.

      I like that we don't have to manually parse params/query out of the full request URI. It provides the data that you are most likely to need, in an readily/easily-usable form.

  11. Oct 2020
    1. You can set options.params to a POJO as shown above, or to an instance of the JavaScript's built-in URLSearchParams class. const params = new URLSearchParams([['answer', 42]]); const res = await axios.get('https://httpbin.org/get', { params });
  12. Sep 2020
  13. react-spectrum.adobe.com react-spectrum.adobe.com
    1. let {focusProps} = useFocus({ onFocus: (e) => setEvents((events) => [...events, 'focus']), onBlur: (e) => setEvents((events) => [...events, 'blur']), onFocusChange: (isFocused) => setEvents((events) => [...events, `focus change: ${isFocused}`]) });