Wanted to create a (daily) time series chart with automatic rollups to weekly/monthly lines AND nice transitions
The solution I ended up going with is a bit of an optical illusion.
All three views are technically backed by "daily" data.
const delay = require('delay') | |
async function* makeCountingObservable() { | |
let count = 0 | |
while(true) { | |
if (count > 4) return | |
await delay(1000) | |
yield count++ | |
} | |
} | |
const counter = makeCountingObservable() |
license: gpl-3.0 | |
redirect: https://beta.observablehq.com/@mbostock/d3-stacked-bar-chart |
#! /bin/bash | |
# ECHO COMMAND | |
# echo Hello World! | |
# VARIABLES | |
# Uppercase by convention | |
# Letters, numbers, underscores | |
NAME="Bob" | |
# echo "My name is $NAME" |
const crypto = require('crypto'); | |
function decryptWithPrivateKey(privateKey, encryptedMessage) { | |
return crypto.privateDecrypt(privateKey, encryptedMessage); | |
} | |
function decryptWithPublicKey(publicKey, encryptedMessage) { | |
const express = require("express"); | |
const mongoose = require("mongoose"); | |
const session = require("express-session"); | |
const MongoStore = require("connect-mongo")(session); | |
// Create the Express application | |
var app = express(); | |
const dbString = "mongodb://localhost:27017/db"; |
const base64url = require("base64url"); | |
const crypto = require("crypto"); | |
const signatureFunction = crypto.createSign("RSA-SHA256"); | |
const verifyFunction = crypto.createVerify("RSA-SHA256"); | |
const fs = require("fs"); | |
/** | |
* ISSUANCE | |
**/ |
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.
In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.
First, let's illustrate the 3 styles by implementing
export interface IProviderComposerProps extends React.PropsWithChildren { | |
/** | |
* Providers list | |
* */ | |
with: React.FC<React.PropsWithChildren>[] | |
} | |
const ComposerFragment: React.FC<React.PropsWithChildren> = ({ | |
children, | |
}): JSX.Element => <>{children}</> |