704 Matching Annotations
  1. Last 7 days
    1. Feature GraphQL REST

      GraphQL vs *REST (table)

    2. There are advantages and disadvantages to both systems, and both have their use in modern API development. However, GraphQL was developed to combat some perceived weaknesses with the REST system, and to create a more efficient, client-driven API.

      List of differences between REST and GraphQL (below this annotation)

  2. Nov 2021
    1. Modern browsers that support the File System Access API (Edge and Chrome today) allow web pages to access the local file system (with your permission).
  3. Oct 2021
    1. This function allows you to modify (or replace) a fetch request for an external resource that happens inside a load function that runs on the server (or during pre-rendering). For example, your load function might make a request to a public URL like https://api.yourapp.com when the user performs a client-side navigation to the respective page, but during SSR it might make sense to hit the API directly (bypassing whatever proxies and load balancers sit between it and the public internet).
    1. Jamstack

      Going Jamstack with React, Serverless, and Airtable

      Exploring the possibility of integrating Airtable into the Builders Collective, I started looking into the Airtable API and integration into a Jamstack workflow. A CSS-Tricks article came up in a search.

  4. www.programmableweb.com www.programmableweb.com
    1. Hypothesis REST API

      The Hypothesis API integrates annotations into web services. Available to send HTTP requests and JSON responses, it aims to be useful for researchers, scientists, and educators.

    1. Using the Hypothesis API

      What might it take to demo a Jamstack approach to connecting Airtable to Hypothesis with serverless functions in Netlify?

    1. collectionoptionalobject​

      This is NOT clear.. how you actually post a raindrop and setting collection is with "collectionId". e.g. { "link": "https://www.lipsum.com/", "collectionId": 20489957<br> }

  5. Sep 2021
  6. Jul 2021
    1. Arel is a public API, or more precisely, it exposes one. Active Record just provides convenience methods that use it under the hood, It's completely valid to use it on it's own. It follows semantic versioning, so unless you are changing major versions (3.x.x => 4.x.x), there is no need to worry about breaking changes.
  7. Jun 2021
  8. May 2021
    1. if (parsed.protocol) { // external fetch response = await fetch(parsed.href, /** @type {import('node-fetch').RequestInit} */ (opts)); } else { // otherwise we're dealing with an internal fetch const resolved = resolve(request.path, parsed.pathname);
    1. CSR asking my Python backed directly (over nginx). Basically, in my particular situation, I want to use most shorter paths for SSR or CSR cases when I have a separate API server under the same domain and nginx frontend.
    2. on CSR it connects to the svelte-kit endpoint which just use a localhost connection. and to optimize this you can use unix sockets in your endpoints to connect to backend server
    3. ah you are talking about a external api endpoint server? then you could use the svelte-kit endpoints as proxy handler
    1. This looks cool but right now, let's say i have an external api which depends on users cookies, the cookies only gets send through internal sk endpoints while ssr even if its the same domain. Couldn't we pass the 'server' request to the serverFetch hook? I would currently have to patch package svelte kit to pass request headers to the external api or create an sk endpoint which proxies the request.
    1. If your python3 executable is named "python" instead of "python3" (this particularly appears to affect a number of Windows users), then you'll also need to modify the first line of git-filter-repo to replace "python3" with "python".
    1. In this section we will use Gatling to load test a simple cloud hosted web server and will introduce you to the basic elements of the DSL. And here i`m adding my own text, doesnt exist on the page. In this section we will use Gatling to load test a simple cloud hosted web server and will introduce you to the basic elements of the DSL. And here i`m adding my own text, doesnt exist on the page.

      this is testing a hyp updating my own notes, and this one is from API

  9. Apr 2021
    1. Lumberjack::Logger does not extend from the Logger class in the standard library, but it does implement a compantible API.
    2. 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 }
    3. 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
    4. # 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)
  10. Mar 2021
    1. data = {}.extend XKeys::Auto # Vs ::Hash, uses arrays for int keys data[:users, 0, :name] # nil data[:users, 0, :name, :raise => true] # KeyError data[:users, :[], :name] = 'Matz' # :[] is next index, 0 in this case # {:users=>[{:name=>"Matz"}]} pick = [:users, 0, :name] data[*pick] # Matz data[:users, 0, :accesses, :else => 0] += 1 # {:users=>[{:name=>"Matz", :accesses=>1}]}
    1. Currently, I’m working on designing the interfaces and it’s real fun!
    2. With all this “monetization” happening around Trailblazer, we will also make sure that all free and paid parts of the project grow adult and maintan an LTS - or long-term support - status. Those are good news to all you users out there having been scared to use gems of this project, not knowing whether or not they’re being maintained, breaking code in the future or making your developers addicted to and then cutting off the supply chain. Trailblazer 2.1 onwards is LTS, and the last 1 ½ years of collaboration have proven that.
  11. Feb 2021
    1. try { const value = await localforage.getItem('somekey'); // This code runs once the value has been loaded // from the offline store. console.log(value); } catch (err) { // This code runs if there were any errors. console.log(err); }

      This looks like the best approach for me. async/await

    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.
    2. I like your API here much better than reform's API.
    3. reform conflates these two responsibilities into a single validate method
    1. @conference_form.submit(conference_params)

      Surprised they called it submit, since that could imply that you're triggering an action called submit.

      They use other verbs to describe this:

      • sync
      • populate
      • write

      Analogous to Reform's sync / sync_models method.

      Actually, the name makes a lot of sense when you see it in context:

          @conference_form = ConferenceForm.new(conference)
          @conference_form.submit(conference_params)
      
          if @conference_form.save
      
    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
  12. Jan 2021
    1. Path parameters:

      • Identify a resource uniquely

      Request body:

      • Send and receive data via the REST API, often specifically to upload data.
      • Needs to adhere to REST API principles to be RESTful. Therefore for POST/PUT, needs to send the whole resource in the body.

      Query:

      • Mainly used for filtering. If you send a query asking for a large number of resources, use query parameters to filter the set of resources that you want. Example: You send a request to api/pictures/category/cat. You will now get all pictures with cats which could be millions. You can put in the query more specific parameters to clarify your request, such as: api/pictures/category/cat?color=black&breed=korat. Now you will get the subset of pictures of cats which havethe color black and are korat cats.
  13. 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.

    1. Go is introducing publicly-visible API changes related to these issues in an upcoming major release, which risks making the vulnerabilities public without explicit public disclosure. 

      Whaaat ?!

    1. The best solution that I found while trying to build a masonry component was to package up a pair of components and place child components inside a wrapper - I chose CardLayout and Card such that users would write something like: <CardLayout> <Card><MyBeautifulCard /></Card> <Card><AnotherCard /></Card> </CardLayout>
    2. Hm, React-way is really hacky... When we talking about lists, masonry, or any other table-style components, first of all, we talk about arrays and iteration through them. If you iterate over the children in the Masonry component, somewhere (in parent component I guess) you also iterate over the actual items. Over and over again, in all places you use this component, you perform almost the same iteration twice. Why we should do this? I believe the interface of this kind of components should look like this: <Masonry {items} {colsNum} let:item> <SomeItemComponent>{item}</SomeItemComponent> </Masonry>
    3. <script> export let items = []; export let colsNum = 3; $: cols = items.reduce(...); </script> {#each cols as col} {#each col as item} <slot {item} /> {/each} {/each}
    1. I think the main difference between the two are the way API are served. Some smelte components need you to input big chunk of json as props, while i prefer keep props as primitive types and in the other hand give you different components tags to compose.
    2. I don't think this is what really matters at the end, since whatever is the implementation the goal should be to provide a library that people actually like to use.
  14. Nov 2020
    1. The Object.getPrototypeOf() method returns the prototype (i.e. the value of the internal [[Prototype]] property) of the specified object.

      internal: [[Prototype]]

      Other times we see something used to indicate it is internal. In fact, this even supersedes proto__. So why did they use a different naming convention? Did they decide [[ ]] is a better naming convention?

    1. Adapters are strictly versioned: any change to an adapter interface - associative or not - is considered breaking and will cause a major version update of the component.
    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. The details of what goes into a policy vary for each service, depending on what actions the service makes available, what types of resources it contains, and so on.

      This means that some kinds of validation cannot be done on write. For example, I've been able to write Resource values that contain invalid characters.

    1. However, this coalescing was very complicated, both in the specification and implementations, due to the dynamism of computed property names for accessors. Coalescing was a big source of overhead (e.g., in terms of code size) in polyfill implementations of "Stage 2" decorators.
    1. But using internal api's is dangerous as these may change when you update svelte. If you decide to use this, add a line to your project Readme.md mentioning which internal api's you used and why. Try to write it using other methods when you can.
    1. Some of the verbs implemented by systemctl are designed to provide a high-level overview in a human readable format. All that information is available over dbus, and/or journalctl, systemctl show. We could provide that information in json format, but there's a second problem. Information and format of information printed by e.g. systemctl status is not stable. Since the output is not suitable for programmatic consumption anyway, there's no need to provide it in a machine readable format.
  15. Oct 2020
    1. React Final Form was written by the same guy (@erikras) that wrote Redux Form, so much of the API is exactly the same.
    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 });
    1. This assumes that the module has been given a well-defined, stable description (the interface in the sense of information hiding).
    1. We get a boilerplate-free API where shared state has the same simple get/set interface as React local state (yet can be encapsulated with reducers etc. if needed).
    2. We want to improve this while keeping both the API and the semantics and behavior as Reactish as possible.
    1. Once again I am reminded of the importance of API 101 demos, and how I need to focus more in this area.

      I'd love to see a list of API 101 demos. This would be particularly cool if there were a DS106-esque site for content like this. Examples can be powerful things.

    1. My hope is that it will somehow bring comments on Facebook back to the blog and display them as comments here.

      Sadly, Aaron Davis is right that Facebook turned off their API access for this on August 1st, so there currently aren't any services, including Brid.gy, anywhere that allow this. Even WordPress and JetPack got cut off from posting from WordPress to Facebook, much less the larger challenge of pulling responses back.

    1. However, if you want to create a backend API that is meant to be consumed only by your frontend, then you don't need REST nor GraphQL — RPC, such as Wildcard, is enough.
    2. For an API used by many third parties with many diverse uses cases, GraphQL is the right tool.
    1. You can add an attribute replace to replace the current entry in the history stack instead of adding a new one.
    1. In Formik, validateOnBlur defaults to true and it allows you to tell Formik not to validate on blur. React Final Form validates on every change by default, and setting validateOnBlur to true is a way to tell React Final Form to only validate on blur (to not validate on change).
    2. both copied much of their API from Redux Form, so, despite working very differently under the hood, there is a lot of overlap in their APIs.
  16. Sep 2020
    1. detach, as an api, should be declarative (ensure the node is detached) instead of imperative (detach the node), allowing it to be called multiple times by performing a noop if the node is already detached. This way, it won't matter if the node is removed from the DOM from outside of svelte.
    1. The onBlur function can take a SyntheticFocusEvent like it would if you had given it directly to an <input/> component, but you can also just call it: props.input.onBlur() to mark the field as blurred (inactive).
  17. medium.com