Skip to content

Instantly share code, notes, and snippets.

View elgalu's full-sized avatar

Leo Gallucci elgalu

View GitHub Profile
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
pguillory / gist:729616
Created December 5, 2010 23:51
Hooking into Node.js stdout
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
write.apply(process.stdout, arguments)
callback(string, encoding, fd)
mjohnsullivan / named_struct.rb
Created May 2, 2011 14:25
Ruby Struct utilities: use named parameters to create Struct-based objects and return JSON from Structs
# Struct utilities
# Author:: Matt Sullivan (
# Attempt to require Ruby Gems; 1.8.X gem support only
require 'rubygems'
rescue LoadError
# Ruby Gems not installed
trongthanh / gist:1196596
Created September 6, 2011 04:37
Emulate slow Internet connection speed on localhost with netem (Ubuntu)
#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms
#Remove the rate control/delay
sudo tc qdisc del dev lo root
renz45 / An_example.markdown
Last active December 4, 2016 21:01
Re-style Sublime Text 2 sidebar to a darker theme

This re-styles your sublime text 2 sidebar to be darker, so it doesn't blind you when using a dark theme.

Dark sublime text 2 sidebar

Save the Default.sublime-theme file into packages/user

carlosmcevilly / gist:2221249
Created March 27, 2012 22:55
fix git commit with wrong email address in git config, before pushing
- you add and commit with the wrong email address in git, and
- your remote has a hook set up to prevent you from pushing with the bad address
Then you need to amend the author of your commit before push can succeed:
1. fix your email address in git config:
$ git config "Your Name"
tobyhede / postsql.sql
Created May 17, 2012 03:08
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8
-- Inspired by
-- JSON Types need to be mapped into corresponding PG types
spalladino /
Created May 23, 2012 11:45
Organizing coffeescript code in a Rails 3 app
if $('#my_div_in_complex_page').length > 0
class Foo

This post has sat as a draft on my computer for well over a year now. I always intended to finish it, but am beyond caring. So I’m just going to publish it in its current form in hopes that it sparks some interesting conversation and avoids beating a dead horse.

Cucumber is a divisive tool. Some people absolutely love it and have an irrational dedication to using it for every single project. Others hate it, either because they haven’t tried it, or tried it on one project and ended up with a steaming pile of sh…step definitions.

I’ve been using cucumber since one of the first few releases. While I have been burned by it on projects, I also have a great appreciation for it.

What’s wrong with cucumber? Technically, nothing. It’s a brilliant tool for creating DSLs to test our applications. The problem with cucumber is YOU: you don’t understand why to use it, when to use it or how to use it. Don’t worry, though, it’s not entirely your fault. Many people are responsible f

MohamedAlaa / tmux-cheatsheet.markdown
Last active July 13, 2024 14:35
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname