Skip to content

Instantly share code, notes, and snippets.

View azizshamim's full-sized avatar
:octocat:
talkin' bout GitHub

Aziz Shamim azizshamim

:octocat:
talkin' bout GitHub
View GitHub Profile
@evanmiller67
evanmiller67 / chili_con_carne.md
Created December 14, 2012 17:18
Frakin' good chili.

Chili Con Carne

=============== This shit is awesome. It's hot, so nut up pansy.
Don't like it that way? Leave out some peppers and spices.
Green bell pepper is for color, substitute another red or yellow for a sweeter taste.
Like different beans? Add them shits too, get wild with Emeril.
Want this to be even better? Cook/mix everything the night before, put in the fridge. Then cook it all day.

Ingredients

@jboner
jboner / latency.txt
Last active May 2, 2024 09:45
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ordinaryzelig
ordinaryzelig / minitest_spec_expectations.md
Last active December 10, 2022 13:34
How to write MiniTest::Spec expectations

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations
@namlet
namlet / Box Coordinates
Created February 9, 2011 23:37
Maintain selection coordinates using a closure. This example using jQuery.
var boxCoord = function(endCoord) {
var coord = endCoord;
return function(anotherCoord) {
return [anotherCoord, coord];
}
}
$('body').mousedown(function(e){
var thate = e;
$(this).mouseup(function(e){