Regular Event Loop
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
import crypto from "crypto"; | |
import { renderToStaticMarkup } from "react-dom/server"; | |
import createMailgun from "mailgun-js"; | |
import type { ActionFunction, LoaderFunction, Session } from "remix"; | |
import { createCookieSessionStorage, json, redirect } from "remix"; | |
/******************************************************************************* | |
* Before we can do anything, we need to make sure the environment has | |
* everything we need. If anything is missing, we just prevent the app from | |
* starting up. |
package com.mindfulness.vibrate; | |
import android.app.AlarmManager; | |
import android.app.PendingIntent; | |
import android.content.Context; | |
import android.content.Intent; | |
import com.facebook.react.bridge.ReactApplicationContext; | |
import com.facebook.react.bridge.ReactContextBaseJavaModule; | |
import com.facebook.react.bridge.ReactMethod; |
#!/bin/bash | |
trap '(read -p "[$BASH_SOURCE:$LINENO] $BASH_COMMAND?")' DEBUG | |
var="mellon" | |
echo "$var" |
{ | |
"name": "testing-npx", | |
"version": "1.0.0", | |
"description": "Let's see how awesome this is", | |
"bin": "./run.js" | |
} |
/** | |
* OOP paradigm | |
*/ | |
class Semaphore { | |
constructor(max) { | |
this.tasks = []; | |
this.counter = max; | |
this.dispatch = this.dispatch.bind(this); | |
} |
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
"Variables {{{ | |
let mapleader="," | |
" }}} | |
" Globals {{{ | |
syntax enable | |
set fileencoding=utf-8 | |
set listchars=space:· " show whitespaces as dots |
function retry(fn) { | |
return function(data) { | |
return new Promise((resolve, reject) => { | |
var retries = 10, | |
error; | |
function attempt() { | |
if (retries === 0) { | |
reject(error); | |
} |
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
import React from 'react'; | |
export default function(LoadingComponent, WrappedComponent) { | |
return function(props) { | |
return ( | |
{ | |
(props.status === 'LOADING') ? <LoadingComponent /> : <WrappedComponent {...props.data} /> | |
} | |
) | |
}; |