Skip to content

Instantly share code, notes, and snippets.

@sethvincent
sethvincent / first.js
Created April 18, 2016 00:42
hypercore with net
var hypercore = require('hypercore')
var net = require('net')
var level = require('level')
var db = level('./db')
var core = hypercore(db)
var feed = core.createFeed({ secretKey: Buffer('1e2e3e4e5e6e7e8e1e2e3e4e5e6e7e8e1e2e3e4e5e6e7e8e1e2e3e4e5e6e7e8e') })
feed.on('upload', function (block, data) {
console.log('uploaded block', block, data)
@sethvincent
sethvincent / first.js
Last active April 17, 2016 23:47
trying out hypercore & discovery-swarm
var hypercore = require('hypercore')
var swarm = require('discovery-swarm')
var level = require('level')
var db = level('./db')
var core = hypercore(db)
var sw = swarm({
dns: {
server: [
@sethvincent
sethvincent / example.js
Last active March 10, 2016 22:24
idea for controller api
var keyboard = require('controller-keyboard')
var gameState = {
input: {}
}
keyboard.subscribe(function (action, active) {
// active is the current inputs that are active
// this is triggered every time the state of a key has changed
// maybe we would do something like this to the game state:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sethvincent
sethvincent / gamestate.md
Last active January 20, 2016 06:51
an idea for a redux-like module for managing the state of a game

gamestate

Manage the state of JavaScript games using unidirectional data flow.

Usage

var createGame = require('gamestate')

var game = createGame(document.body, {
@sethvincent
sethvincent / index.js
Created August 1, 2015 04:12
requirebin sketch
var diff = require('virtual-dom/diff')
var patch = require('virtual-dom/patch')
var createElement = require('virtual-dom/create-element')
var raf = require('raf')
var dataCards = require('data-cards')({
height: window.innerHeight - 100,
rowHeight: 200
})
@sethvincent
sethvincent / readme.md
Last active August 29, 2015 14:25
workflow & permissions ideas

models

  • account (account is a user)
  • profile (one profile per account)
  • organization (accounts belong to organizations)
  • team (organizations have many teams, accounts belong to teams)

permissions

account roles:

  • admin (full control of site)
@sethvincent
sethvincent / ideas.md
Last active August 29, 2015 14:22
Ideas for next few months of Code for Seattle

Rename to Open Seattle.

The goal: create a more diverse membership. We'll still be able to stay a Code for America brigade.

Partner with a local non-profit that can act as fiscal sponsor for 501(c)3 status

That will be a much stronger relationship for supporting our local projects & events, and we'll still be able to receive support from Code for America.

Recruit 2-3 more lead organizers.

@sethvincent
sethvincent / gist:b6b34847e5707b0d772a
Created May 12, 2015 19:02
example of format function option
function accounts (opts) {
this.format = opts.format
}
accounts.prototype.create = function (req, res, cb) {
var self = this
parseBody(req, function (err, body) {
var body = self.format(body)

Flatsheet lets you edit data sets in realtime with your team. If you've used Google Spreadsheets with a library like Tabletop.js to create an ad-hoc mini-CMS, Flatsheet solves that problem more effectively, and is an open-source tool you can host on your own server. Flatsheet integrates with Dat, so you can use Dat to clone any sheet, edit locally, and push changes back to Flatsheet.

Flatsheet recently received a grant from the Knight Prototype Fund, as well as a code sprint grant from OpenNews. You can see a work-in-progress example at http://data.seattle.io