Skip to content

Instantly share code, notes, and snippets.

View flashingpumpkin's full-sized avatar
🏠
Working from home

Alen Mujezinovic flashingpumpkin

🏠
Working from home
View GitHub Profile
@flashingpumpkin
flashingpumpkin / latency.txt
Created May 31, 2012 18:21 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@flashingpumpkin
flashingpumpkin / todo.coffee
Created May 18, 2012 11:00
Cuffs.js Todo App
class TodoController
constructor: ({@context})->
@todos = []
@context.set 'todos': todos
@context.addTodo = ()=>
@todos.push text: @context.get('todo'), done: false
@context.set 'todos', @todos
@context.markDone = (todo)=>
Error: global leak detected: _xdc_
at Runner.checkGlobals (http://192.168.1.102:8000/static/js/mocha/mocha.js:3138:21)
at Runner.<anonymous> (http://192.168.1.102:8000/static/js/mocha/mocha.js:3053:44)
at Runner.emit (http://192.168.1.102:8000/static/js/mocha/mocha.js:235:20)
at http://192.168.1.102:8000/static/js/mocha/mocha.js:3359:14
at Test.run (http://192.168.1.102:8000/static/js/mocha/mocha.js:3002:5)
at Runner.runTest (http://192.168.1.102:8000/static/js/mocha/mocha.js:3304:10)
at http://192.168.1.102:8000/static/js/mocha/mocha.js:3348:12
at next (http://192.168.1.102:8000/static/js/mocha/mocha.js:3232:14)
at http://192.168.1.102:8000/static/js/mocha/mocha.js:3241:7
#!/bin/bash
exclude='(.dotfiles/$|.git)'
# Link files
find ~/.dotfiles/ -type f -name ".*" -exec ln -s -f {} --target-directory=$HOME/ \;
# Copy folders
find ~/.dotfiles/ -maxdepth 1 -name ".*" -type d | grep -vE $exclude | xargs -I {} cp -v -r {} $HOME
@flashingpumpkin
flashingpumpkin / .ctags
Created May 2, 2012 20:55
Coffee Script ctags
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^[ \t]*class[ \t]+([A-Za-z.]+)/\1/,class/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]*\:.*(->|=>).*$/\1/,method/
--regex-coffee=/^[ \t]*(@[A-Za-z.]+)[ \t]*\:.*(->|=>).*$/\1/,staticmethod/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]*=.*(->|=>).*$/\1/,function/
--regex-coffee=/^[ \t]*([A-Z0-9_]+)[ \t]*=.*$/\1/,constant/
{spawn} = require 'child_process'
log = (data)->
process.stdout.write data.toString()
out = (obj)->
obj.stdout.on 'data', log
obj.stderr.on 'data', log
task 'develop', 'Run a dev server', ->
@flashingpumpkin
flashingpumpkin / hack.sh
Created March 31, 2012 16:10 — 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
#
@flashingpumpkin
flashingpumpkin / coroutine.py
Created March 1, 2012 16:55
Decorator for coroutine usage.
def coroutine(func):
"""
A decorator that turns a function with normal input into a coroutine.
This decorator takes care of priming the coroutine, doing the looping and
handling the closing.
The first argument of any decorated function is what was received when
data was sent to the coroutine via the ``.send`` method. All the other
``*args`` and ``**kwargs`` are what was passed to the decorated function
when instantiating the coroutine.
@flashingpumpkin
flashingpumpkin / gist:1684093
Created January 26, 2012 18:06 — forked from leafo/gist:1683661
screenshot sharing
#!/bin/bash
scrot '%Y-%m-%d_%H-%M-%S.png' -s -e 'scp $f leaf@leafo.net:www/shotsnb;echo -n "http://leafo.net/shotsnb/$f" | xclip; rm $f'
notify-send -u normal -t 1000 'Screenshot Ready'
// @name Gumtree location folder
// @description Unfold the location navigation on gumtree
// @match http://www.gumtree.com/*
// @run-at document-start
(function() {
var css, head, node;
css = "#location-tree { display: block !important; } .expandable-tree {visibility: visible !important;}";
try {
head = document.getElementsByTagName("head")[0];