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 {reconcile} from './utils/reconcile.mjs' | |
import {bar} from './bar-component.mjs' | |
import {baz} from './baz-component.mjs' | |
export const app = () => { | |
/// This is a component; it creates a node, sets some invariant properties on | |
/// that node (e.g., handler functions, sometimes CSS classes, &c.). | |
/// => any => Object |
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
// A pattern for creating objects with public, private, and static methods | |
// without relying on bad parts of javascript. | |
const myType = id => { | |
// Creates a silly type that acts like a class. | |
// => Object | |
const token = Math.random() | |
const hmac = ghmac(token) |
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
### Keybase proof | |
I hereby claim: | |
* I am jeffmcmahan on github. | |
* I am jeffmcmahan (https://keybase.io/jeffmcmahan) on keybase. | |
* I have a public key ASC3jAtlxxlcBa5i4OLHdTL4NXExKExGX0pP5PFXofrsngo | |
To claim this, I am signing this object: |
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
'use strict' | |
/** | |
* Maps the given value to a value expressible in SQL. | |
* @param {*} val | |
* @return {String} | |
*/ | |
function sqlValue(val) { | |
if (val === null) return null | |
if (val === "'null'") 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
'use strict' | |
/** | |
* Print null/undefined and arrays to strings sensibly. | |
* @param {*} val | |
* @param {String} str | |
* @return {String} | |
*/ | |
function htmlValue(val, str) { | |
if (val === null || typeof val === 'undefined') return '' |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Default Props</title> | |
</head> | |
<body> | |
<script> | |
'use strict' | |
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 recursiveReaddirSync = function (topDir) { | |
function readdir (dir) { | |
fs.readdirSync(dir).filter(function (pth) { | |
return !/^\./.test(pth) | |
}).forEach(function (pth) { | |
pth = path.join(dir, pth) | |
if (fs.lstatSync(pth).isDirectory()) readdir(pth) | |
else files.push(pth) | |
}) | |
} |
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
// Calling reAsyncReaddir("file/path", callback) passes an object composed of | |
// a "files" array and a "directories" array (=keys) to your callback. | |
var fs = require("fs"); | |
var results = { | |
"files" : [], | |
"directories" : [] | |
}; | |
var counts = { | |
"fsObjects" : 0, |