Skip to content

Instantly share code, notes, and snippets.

@dustin
dustin / caperturber.go
Last active December 16, 2015 05:19
Example rate limited writer in go. Specify bytes per second and it will constrain you.
// This is just a creepy text effect over a writer just to demonstrate
// more io layering.
package main
import (
"io"
"math/rand"
"unicode"
"unicode/utf8"
@mcdonc
mcdonc / gist:3898894
Created October 16, 2012 12:11
oh my god i'm using emacs to reindent html in sublime text 2
# Sublime's HTML reindenting is currently pretty bad. And Tidy and xmllint
# change my code in ways I don't really like or need. I just need the thing
# reindented sanely. Emacs did that pretty well.
#
# One thing led to another. A few drinks later and now I'm using Emacs to
# reindent HTML from within Sublime.
#
# Save the contents of this file as ohmygodemacs.py in your User directory.
# Then save the contents of the following docstring as ohmygodemacs.elsip in your
# User directory
@voidfiles
voidfiles / app_net_grids.md
Created August 15, 2012 19:01
How App.net uses YUI3 grids

How you can create a responsive grid system using YUI3 grids and SASS

This is a quick rundown of how and why we use YUI3 grids at App.net

As far as I can tell there are three types of CSS grids: a static-width pre-defined grid, a flexible-width pre-defined grid, and a generative grid. In the first two grids (pre-defined width), you basically decide how many columns you have across the screen, and then create blocks in any multiple of those. This pattern often looks like "span-4", "span-6", "pull-10", "push-5", etc. You find this style in popular frameworks like Bootstrap and Blueprint.

The third way, the generative/recursive grid system, doesn't seem to be as popular as the others. I am not entirely sure why, because the generative grid can pack more punch in less lines. In this vein is there is OOCSS and YUI3 CSS Grids.

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

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  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@rsuniev
rsuniev / zipper.hs
Created April 14, 2011 10:53
JSON Zipper
module Zipper where
import Data.List
import Text.JSON
import Data.Maybe
import Control.Monad
data JSZipper = JSZipper {
parent :: Maybe JSZipper,
lefts :: [JSValue],
@sbisbee
sbisbee / couchdb-csrfTokens
Created February 8, 2011 23:04
Proposal on how to prevent CSRF attacks against CouchDB with tokens.
Proposal to Prevent CSRF Attacks on CouchDB with Tokens
=======================================================
This is a draft for commentary from the community.
Goals
-----
1. Establish a mechanism that would defeat CSRF attacks against CouchDB by
leveraging the standard provided by OWASP at