Skip to content

Instantly share code, notes, and snippets.

View chrisdickinson's full-sized avatar

Chris Dickinson chrisdickinson

View GitHub Profile
import itertools
def complex_itermerge(compare, *iters):
_i = [iter(i) for i in iters]
backlog = []
for _i_vals in itertools.izip(*_i):
assoc = zip(_i, _i_vals)
state_length = len(assoc)
for i in range(0, state_length):
lhs = assoc[i]
from waiter import Waiter
waiter = Waiter()
waiter/"https://twitter.com/users/show.json"/{
'screen_name':'isntitvacant',
}
#include <v8.h>
using namespace v8;
// so yeah my algorithms are a little rusty it turns out.
// this is largely from memory.
// )`: don't hate
int64_t fibonacci(int64_t input) {
int64_t two_before = 0;
int64_t one_before = 1;
class Fab(object):
def __enter__(self):
self._stack = []
return self
def __exit__(self, *args, **kwargs):
print self._stack
def __call__(self, *args):
self._stack += args
@chrisdickinson
chrisdickinson / browser.html
Created July 10, 2010 20:00
interop between browser js and commonjs
<script type="text/javascript" src="namespace.js"></script>
<script type="text/javascript" src="example.module.js"></script>
<script type="text/javascript">
console.log(example.module.test_fn("hello", "world"));
</script>
@chrisdickinson
chrisdickinson / WIP_whisper.js
Created July 30, 2010 17:18 — forked from toastdriven/WIP_base.html
FULL ON DOUBLE RAINBOW
// Whisper.js
// A light-weight blog in node.js.
// Requires:
// http://github.com/ry/node_postgres.git
// http://github.com/chrisdickinson/pieshop.git
// http://github.com/chrisdickinson/postpie.git
// ..and JSDTL, but that's not publically available yet (sorry)
// Licensed under the BSD.
/*
// modifying the calling function's context
// in javascript to emulate operator overloading OR:
// ...
// now you're thinking with portals
var sys = require('sys');
var Toy = function() {
this.toyList = [];
};
from dulwich import client
import paramiko
class ParamikoWrapper(object):
def __init__(self, host, command, username, port):
self.client = paramiko.SSHClient()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.client.connect(host, username=username)
self.streams = self.client.exec_command(command[0])
self.write = self.streams[0].writelines
self.read = self.streams[1].readline
sys: require 'sys'
require './jsdocstring'
howdy: (lol) ->
"Well hello there, folks. I'm testing out my docString thing.
In coffeescript.
DocStrings are awesome."
lol
var Difference = function(milliseconds) {
if(milliseconds instanceof Object) {
var output = 0;
output += milliseconds.days === undefined ? 0 : 86400000;
output += milliseconds.hours === undefined ? 0 : 3600000;
output += milliseconds.minutes === undefined ? 0 : 60000;
output += milliseconds.seconds === undefined ? 0 : 1000;
output += milliseconds.milliseconds === undefined ? 0 : milliseconds;
milliseconds = output;