This file contains hidden or 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
<html> | |
<head> | |
<link href="style.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<h3>Graph: Dragons</h3> | |
<div class="legend legendX"><div>Scariness ️→</div></div> | |
<div class="legend legendY"><div>Actual Power →</div></div> | |
<!-- http://bit.ly/neuralvanilla --> | |
<canvas id="wowacanvas" width="1000" height="1000"></canvas> |
This file contains hidden or 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 Pusher = require('pusher') | |
const secrets = require('./secrets') | |
const Encryptor = require('simple-encryptor') | |
const R = require('ramda') | |
const encrypt = R.curry((secret, data) => Encryptor(secret).encrypt(data)) | |
const encryptWithSecret = encrypt(secrets.e2eSecret) | |
const trigger = R.curry((secrets, channel, event, message) => { | |
const client = new Pusher({ | |
appId: secrets.appId, |
This file contains hidden or 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 delay = require('delay') | |
async function* makeCountingObservable() { | |
let count = 0 | |
while(true) { | |
if (count > 4) return | |
await delay(1000) | |
yield count++ | |
} | |
} | |
const counter = makeCountingObservable() |
This file contains hidden or 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
//@ts-check | |
const util = require('util') | |
const fs = require('fs') | |
const path = require('path') | |
const writeFile = util.promisify(require('fs').writeFile) | |
const readFile = util.promisify(require('fs').readFile) | |
function createSniffer({ | |
fixtureDirectory, | |
dummy = false |
This file contains hidden or 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
// Imports the Google Cloud client library | |
const speech = require('@google-cloud/speech') | |
const record = require('node-record-lpcm16') | |
const client = new speech.SpeechClient({ | |
// generated service key downloaded from cloud console | |
credentials: require('./admin-key.json') | |
}) | |
const sampleRateHertz = 16000 |
This file contains hidden or 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 fs = require('fs') | |
fs.readFile('hello.txt', 'utf8', (error, content) => | |
content | |
.split('\n') | |
.filter(line => line.includes('dog')) | |
.forEach(line => console.log(line)) | |
) |
This file contains hidden or 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 orderTotal(fetch, order) { | |
fetch('https://vatapi.com/v1/country-code-check?code=' + order.country) | |
return Promise.resolve(order.items.reduce((prev, cur) => | |
cur.price * (cur.quantity || 1) + prev, 0)) | |
} | |
module.exports = orderTotal |
This file contains hidden or 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 orderTotal(order) { | |
return order.items.reduce((prev, cur) => cur.price * (cur.quantity || 1) + prev, 0) | |
} | |
module.exports = orderTotal |
This file contains hidden or 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 orderTotal(order) { | |
return order.items.reduce((prev, cur) => cur.price * (cur.quantity || 1) + prev, 0) | |
} | |
if (orderTotal({ | |
items: [ | |
{ 'name': 'Dragon candy', price: 2, quantity: 3 } | |
] | |
}) !== 6) { | |
throw new Error('Check fail: Quantity') |
This file contains hidden or 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 fetch = require('node-fetch') | |
const fs = require('fs') | |
require('dotenv').config(); | |
const accessToken = process.env.PATREON_ACCESS_TOKEN | |
const pageCount = 100 | |
const url = `https://www.patreon.com/api/oauth2/api/campaigns/1137737/pledges` + | |
`?type=pledge&sort=created&page%5Bcount%5D=${pageCount}&access_token=${accessToken}` | |
const getPatreonData = function (url, pledges = []) { |