This file contains 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 net = require('net') | |
var level = require('level') | |
var multileveldown = require('multileveldown') | |
var db = level(__dirname + '/db') | |
var write = createServer().listen(9000) | |
var read = createServer({readonly: true}).listen(9001) | |
function createServer (opts) { |
This file contains 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 server = http.createServer(handler) | |
var wsock = shoe(function (stream) { | |
var sock = net.connect(config.multilevel) | |
sock.on('error', function(err) { | |
sock.destroy() | |
if (err) return console.error(err) | |
}) | |
sock.on('close', function() { |
This file contains 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
// port of http://stackoverflow.com/questions/8870261/how-to-split-text-without-spaces-into-list-of-words | |
var _ = require('lodash') | |
var fs = require('fs') | |
var tape = require('tape') | |
var dictStr = fs.readFileSync(__dirname + '/dump/words-by-freq.txt', 'utf8') | |
var wordsByFreq = dictStr.split('\n') | |
var maxWord = 0 |
This file contains 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
# Your snippets | |
# | |
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to | |
# expand the prefix into a larger code block with templated values. | |
# | |
# You can create a new snippet in this file by typing "snip" and then hitting | |
# tab. | |
# | |
# An example CoffeeScript snippet to expand log to console.log: | |
# |
This file contains 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 lerp = require('lerp') | |
var ease = require('ease-component') | |
var createLoop = require('canvas-loop') | |
var createContext = require('2d-context') | |
var ctx = createContext() | |
var canvas = ctx.canvas | |
var app = createLoop(canvas) | |
app.start() |
This file contains 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 powerdrill = require('powerdrill')('your-api-key-here') | |
function sendEmail (emailOpts, cb) { | |
var message = powerdrill() | |
var to = emailOpts.email | |
var from = 'Authentic Accounts <email@domain.com>' | |
var subject, html | |
if (emailOpts.type === 'signup') { | |
subject = 'Confirm Your Account' |
This file contains 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
... | |
"main": "index.js", | |
"scripts": { | |
"start": "wzrd index.js" | |
}, | |
"keywords": [], | |
... |
This file contains 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 from2 = require('from2') | |
var likeStream = createLikeStream() | |
likeStream.on('data', console.log.bind(console)) | |
likeStream.on('end', function () { | |
console.log('finished!') | |
}) | |
function createLikeStream () { | |
var page = 0 |
This file contains 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 bed = require('canvas-testbed') | |
var Simplex = require('perlin-simplex') | |
var Coord = require('coordinate-systems') | |
var simplex = new Simplex() | |
var TAU = 2 * Math.PI | |
document.body.style.background = '#eee' | |
var state = { |
This file contains 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 GIF = require('gif.jsify') | |
var text3dParticles = require('text-3d-particles') | |
// Takes a bit, open console to see gif rendering progress | |
var opts = | |
{ width: 400 | |
, height: 400 | |
, text: 'P2P' | |
, fontSize: 150 |