- https://itunes.apple.com/us/app/lumino-city/id958604518
- https://itunes.apple.com/us/app/prune/id972319818
- https://itunes.apple.com/us/app/causality/id928945016
- https://itunes.apple.com/us/app/kami-2/id1133161444
- https://itunes.apple.com/us/app/connectly/id1014519980
- https://itunes.apple.com/us/app/altos-adventure/id950812012
- https://itunes.apple.com/us/app/love-you-to-bits/id941057494
- https://itunes.apple.com/us/app/alice-in-wordland/id1196607505
- https://itunes.apple.com/us/app/never-alone-ki-edition/id1065127755
- https://itunes.apple.com/us/app/i-love-hue/id1081075274
View iteratePromises.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// per https://twitter.com/yoshuawuyts/status/1494119486429007879 | |
// "In JavaScript, is there a function which takes N Promises, and returns an asyncIterator which yields N resolved values?" | |
let promises = Array.from({length: 10}, (n, i) => { | |
return new Promise(cb => setTimeout(cb, Math.random() * 1e3, i)) | |
}) | |
let iterator = iteratePromises(promises) | |
for await (let value of iterator) console.log(value) |
View view-source.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default (build, namespace = 'view-source') => ({ | |
name: namespace, | |
setup({initialOptions, onLoad, onResolve}) { | |
let options = {...initialOptions, write: false} | |
let filter = new RegExp(`^${namespace}:`) | |
onResolve({filter}, ({path, importer}) => { | |
path = path.replace(filter, '') | |
try { importer = new URL(importer) } | |
catch (e) { importer = new URL(`${namespace}://${importer}`) } |
View tee.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tee(asyncIterable) { | |
let source = asyncIterable[Symbol.asyncIterator]() | |
return [[], []].map((buffer, i, buffers) => ({ | |
async next() { | |
if (0 in buffer) return buffer.shift() | |
let item = await source.next() | |
if (!item.done) buffers[1 - i].push(item) |
View iterator.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example usage: | |
// | |
// void async function() { | |
// let [clicks, onclick] = iterator() | |
// document.querySelector('button').addEventListener('click', onclick) | |
// for await (let click of clicks) console.log(click) | |
// }() | |
export default function iterator() { | |
let done = false |
View s3-etag.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {createReadStream} = require('fs') | |
const {createHash} = require('crypto') | |
module.exports = (path, chunkSize = 5242880) => { | |
return new Promise((resolve, reject) => { | |
const hashes = [] | |
const options = {highWaterMark: chunkSize} | |
const rs = createReadStream(path, options) | |
rs.on('error', reject) |
View deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
aws cloudformation deploy \ | |
--template-file stack.yaml \ | |
--stack-name edge-lambda-test \ | |
--capabilities CAPABILITY_IAM \ | |
--parameter-overrides Nonce=$RANDOM |
View template.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Resources: | |
GetFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
Handler: index.handler | |
Runtime: nodejs6.10 | |
CodeUri: index.js | |
Events: |
View recommendations.md
View jabberwocky.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Twas brillig, and the slithy toves | |
Did gyre and gimble in the wabe: | |
All mimsy were the borogoves, | |
And the mome raths outgrabe. | |
"Beware the Jabberwock, my son! | |
The jaws that bite, the claws that catch! | |
Beware the Jubjub bird, and shun | |
The frumious Bandersnatch!" | |
So rested he by the Tumtum tree, | |
And stood awhile in thought. |
View handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
// for context, see https://twitter.com/jedschmidt/status/732244756491816960 | |
const https = require('https') | |
const qs = require('querystring') | |
const WEBHOOK_PATH = '/services/YOUR_WEBHOOK_PATH_HERE' | |
const EVENTS_BY_CLICKTYPE = { | |
SINGLE : {emoji: ':coffee:', type: 'beverages'}, |
NewerOlder