Skip to content

Instantly share code, notes, and snippets.

View defvol's full-sized avatar

Rodolfo Wilhelmy defvol

View GitHub Profile
//
// NSObject+BlockObservation.h
// Version 1.0
//
// Andy Matuschak
// [email protected]
// Public domain because I love you. Let me know how you use it.
//
#import <Cocoa/Cocoa.h>
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@jasonrudolph
jasonrudolph / about.md
Last active November 13, 2025 16:55
Programming Achievements: How to Level Up as a Developer
@albertopadilla
albertopadilla / gist:1330093
Created November 1, 2011 07:25
i18n Translation Spanish (Mexico - Usted)
es:
errors:
messages:
expired: "ha expirado, por favor pida uno nuevo"
not_found: "no encontrado"
already_confirmed: "ya está confirmada, por favor intente ingresar"
not_locked: "no está bloqueada"
not_saved:
one: "1 error evitó que este %{resource} fuera guardado:"
other: "%{count} errores evitaron que este %{resource} fuera guardado:"
@amscotti
amscotti / mongo_urlshortener.rb
Created April 2, 2012 20:04
Example of using MongoMapper and Sinatra to make an url shortener - http://bit.ly/wZw0TO
require "rubygems"
require "sinatra"
require "haml"
require "mongo_mapper"
class Shorten
include MongoMapper::Document
key :url, String
key :shorten_id, String
@cutemachine
cutemachine / gradient_view.rb
Created May 10, 2012 14:58
GradientView with RubyMotion
class GradientView < UIView
def initWithFrame(frame)
if super
rgb = CGColorSpaceCreateDeviceRGB()
ptr = Pointer.new(:float, 8)
ptr[0] = 1.0
ptr[1] = 0.0
ptr[2] = 0.0
ptr[3] = 1.0
ptr[4] = 0.0
@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

@alloy
alloy / Instructions.md
Created June 28, 2012 12:56
Run iOS unit tests (in a Xcode workspace) when a file changes and *only* those tests related to the changed file. Also trims otest output and colors test results.
@defvol
defvol / laMagicaSerieFibonacci.js
Created August 14, 2012 02:32
El día que García Márquez escribió JavaScript
/*
El mundo era tan reciente, que muchas cosas carecían de nombre,
y para mencionarlas había que señalarlas con el dedo.
Todos los años, por el mes de marzo, una familia de gitanos
desarrapados plantaba su carpa cerca de la aldea, y con un
grande alboroto de pitos y timbales daban a conocer los
nuevos inventos.
En un marzo volvieron los gitanos. Esta vez llevaban la sucesión
static NSInteger NSJSONReadingFuckNSNulls = (1UL << 3);
@implementation NSJSONSerialization (FuckNulls)
+ (void)load {
Method originalMethod = class_getClassMethod(self, @selector(JSONObjectWithData:options:error:));
IMP swizzledImplementation = imp_implementationWithBlock([^id (id _self, NSData *_data, NSJSONReadingOptions _opt, NSError **_error){
NSInputStream *stream = [NSInputStream inputStreamWithData:_data];
[stream open];