Skip to content

Instantly share code, notes, and snippets.

@msimpson
msimpson / .Xdefaults
Created January 7, 2012 16:57
Darken
urxvt.termName: rxvt
urxvt.loginShell: true
urxvt*urlLauncher: /usr/bin/chromium
urxvt*perl-lib: /usr/lib/urxvt/perl/
urxvt*perl-ext-common: default,matcher,searchable-scrollback
urxvt*font: xft:DejaVu Sans Mono:pixelsize=10
urxvt*boldFont: xft:DejaVu Sans Mono:pixelsize=10
urxvt.scrollBar: false
urxvt.saveLines: 65535
urxvt.secondaryScroll: true
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@moraes
moraes / gist:2141121
Last active May 1, 2023 19:02
LIFO Stack and FIFO Queue in golang
package main
import (
"fmt"
)
type Node struct {
Value int
}
@barraponto
barraponto / git-submodule-rm.sh
Created April 25, 2012 16:36
git submodule-rm
#!/bin/bash
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}
@renato-zannon
renato-zannon / module.rb
Created September 4, 2012 04:07
Subclass module + use module_eval to define methods
class AttributeAccessor < Module
def initialize(name)
@name = name
module_eval { define_accessors }
end
private
def define_accessors
ivar = "@#{@name}"
@nhance
nhance / method_logger.rb
Created September 6, 2012 12:58
Rails compatible method logging. Use this to log all calls to instance methods of a class to the log.
Model.new.foo
@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@mburst
mburst / bloomfilter.py
Created February 3, 2013 05:26
Code for creating and testing a simple bloom filter - http://maxburstein.com/blog/creating-a-simple-bloom-filter/
from bitarray import bitarray
import mmh3
class BloomFilter:
def __init__(self, size, hash_count):
self.size = size
self.hash_count = hash_count
self.bit_array = bitarray(size)
self.bit_array.setall(0)
@sj26
sj26 / assets.rake
Last active May 13, 2023 04:42
Don't discard cache during asset precompile. Full explanation and caveats: http://sj26.com/2013/02/09/the-asset-pipeline-isnt-actually-slow
# Stick this in lib/tasks/assets.rake or similar
#
# A bug was introduced in rails in 7f1a666d causing the whole application cache
# to be cleared everytime a precompile is run, but it is not neccesary and just
# slows down precompiling.
#
# Secondary consequences are the clearing of the whole cache, which if using
# the default file cache could cause an application level performance hit.
#
# This is already fixed in sprockets-rails for rails 4, but we patch here for
@TylerRick
TylerRick / delegate_to_all.rb
Last active March 29, 2020 06:01
DelegateToAll. Like delegate.rb from Ruby's std lib but lets you have multiple target/delegate objects.
# DelegateToAll. Like delegate.rb from Ruby's std lib but lets you have multiple target/delegate objects.
require 'delegate'
class DelegatorToAll < Delegator
# Pass in the _obj_ to delegate method calls to. All methods supported by
# _obj_ will be delegated to.
#
def initialize(*targets)
__setobj__(targets)