Skip to content

Instantly share code, notes, and snippets.

@sethvincent
sethvincent / index.js
Created November 27, 2016 19:11
a merry township
const merry = require('merry')
const township = require('township')
const ship = township()
const log = merry.log('main')
const app = merry({
log: { stream: process.stdout },
env: { PORT: 8080 }
})
@sethvincent
sethvincent / readme.md
Last active November 23, 2016 04:26
township auth flow

Create user

  • client sends request to api server to create user with email and password
  • api server stores email and salted password

Log in

  • client sends request to api server to log in with email and password
  • api server checks email & password, then creates & signs token if correct and returns to client
  • client stores token (e.g. local storage if browser)

Authenticated requests

var choo = require('choo')
var html = require('choo/html')
var app = choo()
app.router(function (route) {
return [
route('/', home)
route('/:page', page)
]
@sethvincent
sethvincent / lightning-line-example.js
Created August 6, 2016 20:41
lightning-line example
var Line = require('lightning-line')
var html = require('yo-yo')
function render () {
return html`
<div id="app">
${viz()}
</div>
`
}

app.model, reducers, effects, & subscriptions:

app.model({
  state: {},
  reducers: {
    exampleReducer: function (data, state) { return data }
  },
  effects: {
 exampleEffect: function (data, state, send, done) { return data }
var html = require('choo/html')
var css = require('sheetify')
var L = require('mapbox.js')
L.mapbox.accessToken = 'pk.eyJ1Ijoic2V0aHZpbmNlbnQiLCJhIjoiSXZZXzZnUSJ9.Nr_zKa-4Ztcmc1Ypl0k5nw'
module.exports = function (state, prev, send) {
var prefix = css`
:host {
width: 100%;
height: 100%;
@sethvincent
sethvincent / example.js
Created June 24, 2016 22:34
example of mounting choo on a pathname like username.github.io/project-name, where basedir === project-name
app.router(function (route) {
var routes = [
route('/', main),
route('/:page', main)
]
if (opts.basedir) {
return route(opts.basedir, routes)
}
@sethvincent
sethvincent / readme.md
Created May 18, 2016 19:34
garden arcade
  • clear weeds from the farm
  • at the beginning of the game, you're given a seed to plant
  • to make the plant grow, you need a crowd of people gathered around
  • every time a plant has grown, it drops a seed
  • you can spy on the other farm
    • you see a gif of their most recent crowd of people cheering on their plant as it grows
  • you see how many plants they've grown
�[91m[TerminalIPythonApp] WARNING | Subcommand `ipython trust` is deprecated and will be removed in future versions.�[0m
�[91m[TerminalIPythonApp] WARNING | You likely want to use `jupyter trust`... continue in 5 sec. Press Ctrl-C to quit now.�[0m
�[91m[TrustNotebookApp] Writing notebook-signing key to /home/main/.local/share/jupyter/notebook_secret�[0m
Signing notebook: /home/main/notebooks/index.ipynb
---> fe39a36c8899
Removing intermediate container 52b457d9f056
Step 10 : ADD requirements.txt requirements.txt
---> d1f3b288a172
Removing intermediate container 00dad1bf3fd4
@sethvincent
sethvincent / readme.md
Created April 20, 2016 00:08
binder docs

binder docs

docs.mybinder.org

  • should the binder docs include any jupyter/ipython or github docs? say i'm a researcher that hasn't used github much or at all, or a data journalist that's new to jupyter notebooks. i guess at least link to the relevant docs.
  • add an overview with a directory of the different types of docs and who they are meant to help
    • users
    • devs

custom deployment

  • could create deployment guides for different environments: