Skip to content

Instantly share code, notes, and snippets.

View frame-protocol.js
A simple new-line delimited JSON protocol with upgrades.
Receiving Usage:
protocol = require('./frame-protocol');
// parsing data
parser = protocol.Parser();
srid / subcommand.go
Created Oct 24, 2012
golang simple subcommand parser
View subcommand.go
// A simple sub command parser based on the flag package
package subcommand
import (
type subCommand interface {
creationix / run.js
Last active Nov 27, 2017
A tiny generator helper for consuming callback code directly
View run.js
function run(generator) {
var iterator = generator(resume);
var data = null, yielded = false;;
yielded = true;
function check() {
while (data && yielded) {
aaronjensen / edit_data_bag.rb
Created Nov 21, 2012
Edit encrypted data bags for use with chef-solo and knife-solo
View edit_data_bag.rb
#!/usr/bin/env ruby
Dir.chdir File.join(__FILE__, "../..")
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
unless ARGV.count == 2
View find_my_friends.js
var options, req, request;
request = require('request');
options = {
uri: '{account_id}/{unique_device_id}/minCallback/selFriend/refreshClient',
method: 'POST',
headers: {
'X-Apple-AuthScheme': 'Forever',
'Content-type': 'application/json'
sjl / nextlast.vim
Created Sep 21, 2012
next/last text objects
View nextlast.vim
" Next and Last {{{
" Motion for "next/last object". "Last" here means "previous", not "final".
" Unfortunately the "p" motion was already taken for paragraphs.
" Next acts on the next object of the given type in the current line, last acts
" on the previous object of the given type in the current line.
" Currently only works for (, [, {, b, r, B, ', and ".
Protonk / prng.js
Last active Oct 18, 2019
Various PRNGs, implemented in javascript.
View prng.js
// Linear Congruential Generator
// Variant of a Lehman Generator
var lcg = (function() {
// Set to values from
// m is basically chosen to be large (as it is the max period)
// and for its relationships to a and c
var m = 4294967296,
// a - 1 should be divisible by m's prime factors
a = 1664525,
// c and m should be co-prime
mwunsch / emoji_image_replace.js
Last active May 6, 2020
Detect emoji unicode on a page, replace it with images (supplied by GitHub, for now). Goes great in your ~/.js
View emoji_image_replace.js
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
* Much of this code was gleaned from staring at the minified GitHub JS.
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
protocool / caveatPatchor.js
Created Feb 14, 2011
Sample caveatPatchor.js file for use in Propane 1.1.2 and above
View caveatPatchor.js
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
h12w /
Last active Aug 13, 2020 does automatic checking on a Go package and its sub-packages.
# The script does automatic checking on a Go package and its sub-packages, including:
# 1. gofmt (
# 2. goimports (
# 3. golint (
# 4. go vet (
# 5. race detector (
# 6. test coverage (
set -e
You can’t perform that action at this time.