Skip to content

Instantly share code, notes, and snippets.

@passcod
passcod / music-for-making.markdown
Created September 17, 2013 08:35
My playlist for moments of epic creativity

Music for Making

Air Traffic Controller

  • Can't Let Go

Apocalyptica

  • Quutamo
@hamishcampbell
hamishcampbell / polyomino.py
Created September 6, 2013 23:26
Polyomino Reference Source - PyCon 2013
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import sys
class Polyomino(object):
def __init__(self, iterable):
self.squares = tuple(sorted(iterable))
def __repr__(self):
@passcod
passcod / extend.coffee
Last active December 21, 2015 17:29
This is really normal prototypal inheritance, and the #extend and #create methods are just there for convenience, not to hide away the magic.
Namespace.extend = (src, obj = {}) ->
if typeof obj.init is 'function'
newObj = obj.init
delete obj.init
else
newObj = ->
newObj.prototype = Object.create src.prototype
newObj.prototype.constructor = newObj
for prop of obj
@passcod
passcod / hookz.rb
Created August 15, 2013 04:10 — forked from anonymous/hookz.rb
Hookz: Lolcommits plugin to execute custom hooks. Place an executable (shell script, binary, something else with a shebang...) in ~/.lolcommits/project-name/Hookfile, and it will be called every time a commit picture is taken, with its path as argument. Use for anything you can't be bothered writing Ruby for: posting to tumblr, sending email, up…
module Lolcommits
class Hookz < Plugin
def initialize(runner)
super
self.name = 'hookz'
self.default = true
end
def run
@willurd
willurd / web-servers.md
Last active June 1, 2026 13:16
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
anonymous
anonymous / dump
Created May 3, 2013 13:05
7 generations of git://github.com/tbranyen/nodegit.git
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0~ ## ####
1~ # ## ###
2~ ######
3~ # # ## #
4~ # ####
5~ # # #
6~ ##
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@passcod
passcod / attention
Last active December 15, 2015 23:58
Obfuscated
Google's Closure Compiler
throws up if you give it this.
Just sayin'
anonymous
anonymous / gist:5308457
Created April 4, 2013 07:13
Binary-to-url benchmark in node.js
#!/usr/bin/env node
var fs = require('fs');
var re = /(..)/g;
var methods = {
with_escape: function(data) {
return escape(data.toString('binary'));
},
with_loop: function (data) {
@passcod
passcod / toSource2.coffee
Last active December 11, 2015 09:08
Gecko-style #toSource() shim
toSource2 = (data) ->
typ = typeof data
if typ == "number" and isNaN data
"NaN"
else if ["string", "number", "boolean"].indexOf(typ) != -1
JSON.stringify data
else if typ == "function"
"(#{data.toString()})"
else if data instanceof Array
"[#{data.map(toSource2).join(", ")}]"
@passcod
passcod / Gemfile
Created September 20, 2012 05:15
Padrino + Sidekiq = ♥
# ...
gem 'sidekiq'
# ...