Skip to content

Instantly share code, notes, and snippets.

@handloomweaver
handloomweaver / S3 bucket sync
Created February 29, 2016 19:55 — forked from andrewschoen/S3 bucket sync
Python script to sync an S3 bucket to the local file system
# -*- coding: utf-8 -*-
import os
import StringIO
import hashlib
try:
from boto.s3.connection import S3Connection
from boto.s3.key import Key
except ImportError:
raise ImproperlyConfigured, "Could not load Boto's S3 bindings."
after = (ms, cb) -> setTimeout cb, ms
every = (ms, cb) -> setInterval cb, ms

Now we can say:

after 500, -> # do something...

Instead of:

setTimeout ->

import time
import networkx as nx
from contextlib import contextmanager
@contextmanager
def hidden_nodes(G, nodes=None):
import types
if nodes is None:
nodes = []
def successors_iter(G,n):
import time
import networkx as nx
from contextlib import contextmanager
@contextmanager
def hidden(G, nodes=None, edges=None):
if nodes is None:
nodes = []
if edges is None:
edges = []
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
@handloomweaver
handloomweaver / tlc.lua
Created March 28, 2012 17:49 — forked from fjolnir/tlc.lua
LuaJIT ObjC bridge
-- TLC - The Tiny Lua Cocoa bridge
-- Note: Only tested with LuaJit 2 Beta 9 on x86_64 with OS X >=10.7.3 & iPhone 4 with iOS 5
-- Copyright (c) 2012, Fjölnir Ásgeirsson
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@handloomweaver
handloomweaver / gist:2226471
Created March 28, 2012 14:09 — forked from FestivalBobcats/gist:1323387
Underscore.js implementation of Cartesian Product
function cartesianProductOf(){
return _.reduce(arguments, function(mtrx, vals){
return _.reduce(vals, function(array, val){
return array.concat(
_.map(mtrx, function(row){ return row.concat(val); })
);
}, []);
}, [[]]);
}
@handloomweaver
handloomweaver / gist:1953185
Created March 1, 2012 20:57 — forked from FestivalBobcats/gist:1323387
Underscore.js implementation of Cartesian Product
function cartesianProductOf(){
return _.reduce(arguments, function(mtrx, vals){
return _.reduce(vals, function(array, val){
return array.concat(
_.map(mtrx, function(row){ return row.concat(val); })
);
}, []);
}, [[]]);
}
@handloomweaver
handloomweaver / gist:1883530
Created February 22, 2012 09:15 — forked from neilj/gist:1532562
Sugared DOM: Better Than Templates
var el = ( function () {
var doc = document;
var directProperties = {
'class': 'className',
className: 'className',
defaultValue: 'defaultValue',
'for': 'htmlFor',
html: 'innerHTML',
@handloomweaver
handloomweaver / LICENSE.txt
Created February 16, 2012 08:48 — forked from aemkei/LICENSE.txt
Latitude Longitude Distance - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE