Skip to content

Instantly share code, notes, and snippets.

@theladyjaye
theladyjaye / logging.js
Last active December 21, 2015 18:19
Simple port of python's std logging module.
define(function(require, exports, module){
var test = {};
var _ = require('underscore'),
_loggers = {},
_levelNames = {
0: 'NOTSET',
1: 'TRACE',
2: 'DEBUG',
3: 'INFO',
@theladyjaye
theladyjaye / datetime.js
Created August 19, 2013 22:09
datetime module for ISO8601 UTC Dates
define([
], function(){
var months = ['January', 'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September', 'October',
'November', 'December'];
// All values assumed to be ISO 8601 and in UTC
// 2013-08-29T14:29Z
@theladyjaye
theladyjaye / demo.py
Created October 27, 2012 16:55
Python appending lists vs adding lists
from timeit import Timer
from itertools import islice
from itertools import cycle
def add_list_small(target, source):
target += source
def add_list_large(target, source):
@theladyjaye
theladyjaye / build_gitolite_deb.sh
Created October 4, 2012 21:49 — forked from justone/build_gitolite_deb.sh
gitolite v3 debian package
#!/bin/bash
# install rvm
aptitude install -y curl libz-dev
curl -L https://get.rvm.io | bash -s stable --ruby
source /usr/local/rvm/scripts/rvm
gem install fpm
# git clone
aptitude install -y git
@theladyjaye
theladyjaye / fizzbuzz.py
Created August 3, 2012 14:13
Functional-ish fizzbuzz in python
from itertools import cycle, izip
import operator import add
fizz = cycle(['', '', 'fizz'])
buzz = cycle(['','','','','buzz'])
r = izip(fizz, buzz)
index = 1
while index < 101:
print("{}: {}".format(index, add(*r.next())))
index = index + 1
@theladyjaye
theladyjaye / traversals.py
Created February 19, 2012 21:08
Neo4j REST Traversals Approximating embedded syntax for https://github.com/versae/neo4j-rest-client/
# http://docs.neo4j.org/chunked/snapshot/rest-api-traverse.html#rest-api-traversal-returning-nodes-below-a-certain-depth
try:
import simplejson as json
except ImportError:
import json
from neo4jrestclient import client
from neo4jrestclient.request import Request
from neo4jrestclient.request import NotFoundError
/*
smtpd.js is SMTP server written for node.js
MIT License
*/
var tcp = require('tcp');
var sys = require('sys');