Skip to content

Instantly share code, notes, and snippets.

View atdt's full-sized avatar
💭
I may be slow to respond.

Ori Livneh atdt

💭
I may be slow to respond.
  • Google
  • New York City
View GitHub Profile
function debugAccess(obj, prop, debugGet){
var origValue = obj[prop];
Object.defineProperty(obj, prop, {
get: function () {
if ( debugGet )
debugger;
return origValue;
},
import uuid
alphabet = (
'!"#$%&\'()*+,-./0123456789:;<=>?@'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
'[\\]^_`'
'abcdefghijklmnopqrstuvwxyz{|}~'
)
@atdt
atdt / gist:4011501
Created November 4, 2012 11:33 — forked from paulirish/gist:704386
10 or 11 or 12 things i learned from the jquery source
/*
.d dP"Yb dP"Yb 88""Yb .d .d dP"Yb 88""Yb .d oP"Yb. 888888 88 88 88 88b 88 dP""b8 .dP"Y8
.d88 dP Yb dP Yb 88__dP .d88 .d88 dP Yb 88__dP .d88 "' dP' 88 88 88 88 88Yb88 dP `" `Ybo."
88 Yb dP Yb dP 88"Yb 88 88 Yb dP 88"Yb 88 dP' 88 888888 88 88 Y88 Yb "88 o.`Y8b
88 YbodP YbodP 88 Yb 88 88 YbodP 88 Yb 88 .d8888 88 88 88 88 88 Y8 YboodP 8bodP'
88 88 888888 db 88""Yb 88b 88 888888 8888b. 888888 88""Yb dP"Yb 8b d8
@atdt
atdt / heart.js
Created November 4, 2012 11:30 — forked from paulirish/heart.js
sweetass heart canvas.
// 99% done by @rauri rochford
// http://js1k.com/2012-love/demo/1071
// i just rAF'd it.
// demo at http://bl.ocks.org/1823634
e = [];// trails
@atdt
atdt / Destructuring Examples.clj
Created October 10, 2012 01:23 — forked from devn/Destructuring Examples.clj
Destructuring Examples
;;; All Kinds of Destructuring ;;;
(let [foo 1] foo)
; => 1
(let [[foo bar] [1 2 3]] [foo bar])
; => [1 2]
(let [[foo bar & baz] [1 2 3]] [foo bar baz])
; => [1 2 (3)]
@atdt
atdt / resuls
Created July 24, 2012 17:14 — forked from bcg/resuls
Hipster C + ZeroMQ + Redis MQ
zmqd.c = 45k rps
@atdt
atdt / rewrite-history.sh
Created June 23, 2012 03:15 — forked from dsc/git-fat-pack.sh
Permanently remove crap from a git repo.
#!/bin/bash
### Rewrite history (all commits in all branches) without the files that match the pattern
DELETE_PAT="$1"
git filter-branch --tree-filter "rm -rf $1" --prune-empty --tag-name-filter cat -- --all
### filter-branch saves the original history to refs/original
### because we aim to reclaim space, we need to remove it and then gc the refs
git for-each-ref --format="%(refname)" refs/original/| xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
@atdt
atdt / hack.sh
Created March 31, 2012 12:44 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@atdt
atdt / stacktrace.js
Created February 19, 2012 07:47
v8 stack trace
var stack_holder = new Error;
function stackPrepare(e,stacks) {
var stack = stacks
for (var p in stack[0]) {
stack[p] = stack[0][p]
}
stack.find = function(fn) {
for (var i=stack.length;i--;) {
if (stack[i].getFunction() === fn) break;
@atdt
atdt / queryset_generators.py
Created June 2, 2011 02:19 — forked from dbrgn/queryset_generators.py
queryset_generator and queryset_list_generator
def queryset_generator(queryset, chunksize=1000):
"""
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in its
memory at the same time while django normally would load all rows in its
memory. Using the iterator() method only causes it to not preload all the
classes.
Note that the implementation of the generator does not support ordered query sets.