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 formatDate (iso) { | |
const [year, month, day] = iso.split('T')[0].split('-') | |
return `${+month}/${+day}/${year}` | |
} |
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 getFormData = require('get-form-data') | |
const html = require('choo/html') | |
module.exports = function formComponent (opts) { | |
return ` | |
<form> | |
<input name="woof" type="text" placeholder="type here" | |
value=${opts.values.woof} oninput=${onInput}> | |
<input type="submit" onsubmit=${onSubmit}> | |
</form> |
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 yo = require('yo-yo') | |
function parent (title) { | |
return yo`<div>${child(title)}</div>` | |
} | |
function child (title) { | |
const el = yo`<h1>${title}</h1>` | |
window.setTimeout(() => { | |
// silly example, but really referring to L.map() or other init() libraries |
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 choo = require('choo') | |
const html = require('choo/html') | |
const http = require('choo/http') | |
const app = choo() | |
app.model({ | |
effects: { | |
fetch: (data, state, send, done) => { | |
send('sub', (err) => { | |
if (err) { |
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 list = document.querySelector('#filter-list ul') | |
var listItems = Array.from(list.children) | |
var depts = listItems.map((li) => { | |
var link = li.querySelector('.content-department') | |
return link.innerText + "\t" + link.getAttribute('href') | |
}) | |
copy(depts.join("\n")) |
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 choo = require('choo') | |
const html = require('choo/html') | |
const app = choo() | |
app.model({ | |
state: { | |
convos: { | |
'2151234567': generateItems(50), | |
'9891239876': generateItems(50), |
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 html = require('bel') | |
var morphdom = require('morphdom') | |
var saved | |
function child () { | |
saved = saved || html`<h1 onload=${() => console.log('child on')} onunload=${() => console.log('child off')}>child</h1>` | |
return saved | |
} | |
function parent () { |
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 http = require('http') | |
const Readable = require('stream').Readable | |
const formBody = require('body/form') | |
http.createServer(function (req, res) { | |
const stream = new Readable | |
console.log('inbound') | |
formBody(req, {}, (err, body) => { | |
stream.push('hi') | |
stream.push(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
--- | |
layout: default | |
--- | |
{% include breadcrumbs.html parent="Datasets" %} | |
{% assign schema = page.schema | default: site.schema %} | |
{% assign dataset_fields = site.data.schemas[schema].dataset_fields %} | |
{% assign dataset_system_fields = "title|organization|notes|license" | split: "|" %} | |
{% assign resource_fields = site.data.schemas[schema].resource_fields %} | |
{% assign resource_system_fields = "name|url|format|description" | split: "|" %} |
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
client.select('*').from(opts.table).stream() | |
.pipe(through.obj(chunkToFiles)) | |
.pipe(vfs.dest('./' + opts.table)) | |
function chunkToFiles (chunk, enc, callback) { | |
const primaryKey = chunk[opts.primaryKey] | |
const keys = Object.keys(chunk) | |
keys.forEach((key) => { | |
const file = new File({ |