Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / README.md
Created February 24, 2014 17:41
Use of reduce for word counting

Reduce a list of words to counts for each unique word.

@joyrexus
joyrexus / README.md
Created February 25, 2014 03:02
Extending EventEmitter

A quick demonstration of how node's EventEmitter can be extended.

See this gist for another example, demonstrating how EventEmitter can be used to implement the Observer pattern.

@joyrexus
joyrexus / README.md
Last active August 29, 2015 13:56
Concat video howto

How can I concatenate video files?

Use ffmpeg.

Consult this FAQ and this HOWTO for details.

@joyrexus
joyrexus / README.md
Created March 26, 2014 17:55
Make word pairs from Moby Dick

Generate a list of word pairs from Moby Dick.

Taken from Matt Brocklin's post on text benchmarks.

Nice use of pipe and sliding_window here!

Install PyToolz before running: pip install toolz.

@joyrexus
joyrexus / README.md
Created March 26, 2014 20:27
Functional python tutorial
@joyrexus
joyrexus / README.md
Last active August 29, 2015 13:57
Map a function over the values of an object

mapValues

Maps a function over the values of an object.

mapValues = (obj, f) ->
  result = {}
  result[k] = f(v) for k, v of obj
  result
@joyrexus
joyrexus / README.md
Last active August 29, 2015 13:59
Let’s Make a Block

Use gistup to create gists (and blocks) from the command line. The directory containing your gist files gets initialized as a git repo. See this tutorial for a quick overview.

For additional tips on generating block thumbnails, see this block and this HOWTO.

@joyrexus
joyrexus / README.md
Last active August 29, 2015 13:59
Gistup test run

Just testing out gistup and related tutorial for streamlined gist/block generation.

For additional tips on generating block thumbnails, see this block and this HOWTO.

@joyrexus
joyrexus / README.md
Created April 21, 2014 19:24
through2-map examples

A quick demo of through2-map usage.

Extract second column of each row in a CSV file

fs = require 'fs'
csv = require 'csv2'
map = require 'through2-map'
@joyrexus
joyrexus / README.md
Last active August 29, 2015 14:00
Lunar-lander

Use the left and right arrow keys to rotate the ship. Press the up arrow key to turn on the engine.

Try to land the ship safely on the ground. You must land gently or the ship will explode!

Notes

This is an example of Asteroids-style motion. The ship moves in straight lines until the engine is turned on and accelerates. When the ship reaches any of the stage boundaries it is repositioned to the opposite side. The ship rotates at ROTATION_SPEED degrees/second.