This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)
Given the code
| #!/bin/sh | |
| # Based on BMitch's answer from: | |
| # https://stackoverflow.com/questions/38946683/how-to-test-dockerignore-file | |
| # Note: will create and delete temporary file "Dockerfile.build-context" | |
| # 1. Copy to project folder where image is being built | |
| # 2. Run script | |
| # 3. You should see list of files in build context |
| package main | |
| import ( | |
| "crypto/x509" | |
| "encoding/pem" | |
| "io/ioutil" | |
| "log" | |
| "os" | |
| ) |
| package main | |
| /** | |
| * @website http://albulescu.ro | |
| * @author Cosmin Albulescu <cosmin@albulescu.ro> | |
| */ | |
| import ( | |
| "bytes" | |
| "fmt" |
Using JSON in Postgres by example.
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres| //After install, fetch event is triggered for every page request | |
| self.addEventListener("fetch", function (event) { | |
| console.log("Request -->", event.request.url); | |
| //To tell browser to evaluate the result of event | |
| event.respondWith( | |
| caches.match(event.request) //To match current request with cached request it | |
| .then(function(response) { | |
| //If response found return it, else fetch again. | |
| return response || fetch(event.request); |
| /* HOC fundamentally is just a function that accepts a Component and returns a Component: | |
| (component) => {return componentOnSteroids; } or just component => componentOnSteroids; | |
| Let's assume we want to wrap our components in another component that is used for debugging purposes, | |
| it just wraps them in a DIV with "debug class on it". | |
| Below ComponentToDebug is a React component. | |
| */ | |
| //HOC using Class | |
| //it's a function that accepts ComponentToDebug and implicitly returns a Class | |
| let DebugComponent = ComponentToDebug => class extends Component { |
Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded and multipart/form-data.
“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data. Otherwise, use application/x-www-form-urlencoded.”
Matt Bridges' answer in full:
The MIME types you mention are the two Content-Type headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing
While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.
Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.
| uv_run | |
| - uv__update_time(): Update time with millisecond precision. | |
| - uv__run_timers(): Loop through "heap" and run timers whose timeout > time. | |
| - uv__run_pending(): Run all callbacks on the pending_queue. Remove each item | |
| from the queue when run. |