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
var iso31662 = require("iso-3166-2"); | |
function typeValue(a) { | |
switch (a.type) { | |
case 'Outlying area': return 1; | |
default: return 0; | |
} | |
}; | |
[...Object.entries(iso31662.country('USA').sub)].sort(([,a], [,b]) => { |
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
#!/usr/bin/env bash | |
# @see https://github.com/xwmx/bash-boilerplate/blob/d14e016b830b1308174ba9acc461935bb45a20ed/bash-subcommands | |
set -o nounset | |
set -o errexit | |
trap 'echo "Aborting due to errexit on line $LINENO. Exit code: $?" >&2' ERR | |
set -o errtrace | |
set -o pipefail | |
IFS=$'\n\t' | |
############################################################################### |
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
# source this from your ~/.zshrc for Yarn autocompletion | |
# this won't suggest standard Yarn commands (add, upgrade, etc) but will show you custom commands for this project | |
# make sure you have jq installed | |
function _yarn() { | |
local scripts=$(jq -r '.scripts | to_entries | '\ | |
'map(.key |= sub(":";"\\:";"g")) | '\ | |
'.[] | '\ | |
'[select((.value | length) > 0)] | '\ |
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
<div id="back" style="display:none;"></div> | |
{{FrontSide}} | |
<hr id=answer> | |
{{Back}} | |
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 addModule(src) { | |
return new Promise((ok, fail) => { | |
const script = document.createElement('script'); | |
const id = `module-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`; | |
const body = ` | |
import * as myModule from ${JSON.stringify(src)}; | |
document.getElementById(${JSON.stringify(id)}).dispatchEvent(new CustomEvent('moduleloaded', {detail: myModule})); | |
`; | |
script.setAttribute('id', id); |
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
license: gpl-3.0 |
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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import createEffect from './createEffect'; | |
const noop = () => {}; | |
export default class EffectExample extends React.Component { | |
_setGreeting = (greeting) => this.setState({greeting}); | |
_fetchGreeting = createEffect((name) => { | |
if (!name) return null; |
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
/node_modules/ |
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
{ | |
"v": 2, | |
"parserID": "babylon7", | |
"toolID": "jscodeshift", | |
"settings": { | |
"babylon7": null | |
}, | |
"versions": { | |
"babylon7": "7.3.1", | |
"jscodeshift": "0.6.3" |
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
license: gpl-3.0 |
NewerOlder