No, this isn't about render props
I'm going to clean this up and publish it in my newsletter next week!
So react-i18n
(not the npm one... one we made at PayPal internally) has this
function loadStencilCompiler(doc = document) { | |
const s = doc.createElement('script'); | |
// loading from jsdelivr because skypack is not converting this file correctly | |
s.src = 'https://cdn.jsdelivr.net/npm/@stencil/core@latest/compiler/stencil.min.js'; | |
return new Promise((resolve, reject) => { | |
s.onload = () => resolve(window.stencil.transpile); | |
s.onerror = reject; | |
doc.body.appendChild(s); | |
}); | |
} |
import { buildSchema, graphql } from "graphql"; | |
// Construct a schema, using GraphQL schema language | |
let graphqlSchema = buildSchema(` | |
type Query { | |
recipes: [Recipe] | |
recipes_by_pk(id: Int!): Recipe | |
} | |
type Recipe { | |
id: ID! |
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam' | |
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes' | |
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no' |
// faking the firebase API to get as much as we need | |
import localforage from "localforage" | |
import { format } from "date-fns" | |
// localforage.clear() | |
// fakeStreamedData() | |
export const mode = "fake" | |
const FAKE_LATENCY = true |
#!/bin/bash | |
jsfunc() { | |
local code="$(cat)" | |
local fn="$(cat <<EOFF | |
$1() { | |
node <(cat <<EOF | |
require('stream').Readable.prototype.then = function (...args) { return new Promise((res, rej) => { const bufs = []; this.on('error', rej).on('data', buf => bufs.push(buf)).on('end', () => res(Buffer.concat(bufs))); }).then(...args) }; | |
(async () => { | |
${code} | |
})().then(val => typeof val !== 'undefined' && console.log(typeof val === 'string' ? val : JSON.stringify(val, null, 2))).catch(err => console.error(err.stack) || process.exit(1)); |
navigator.serviceWorker.getRegistrations().then(function (registrations) { | |
if (!registrations.length) { | |
console.log('No serviceWorker registrations found.') | |
return | |
} | |
for(let registration of registrations) { | |
registration.unregister().then(function (boolean) { | |
console.log( | |
(boolean ? 'Successfully unregistered' : 'Failed to unregister'), 'ServiceWorkerRegistration\n' + | |
(registration.installing ? ' .installing.scriptURL = ' + registration.installing.scriptURL + '\n' : '') + |
No, this isn't about render props
I'm going to clean this up and publish it in my newsletter next week!
So react-i18n
(not the npm one... one we made at PayPal internally) has this
"use strict" | |
const Nightmare = require("nightmare"); | |
const expect = require("chai").expect; | |
const budo = require("budo"); | |
describe("\u263C basic tests \u263E", () => { | |
const b = budo("../src/main.js"); |
## Open GitKraken using the current repo directory. | |
## For when you want a prettier view of your current repo, | |
## but prefer staying in the cli for most things. | |
## This will break if GitKraken ever removes the -p flag. | |
## If you're not using OSX, the path is definitely different. | |
kraken () { | |
~/Applications/GitKraken.app/Contents/MacOS/GitKraken -p $(pwd) | |
} |