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
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 |
--colour | |
-I app |
package main | |
import ( | |
"fmt" | |
) | |
type Node struct { | |
Value int | |
} |
#!/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 | |
} |
class AttributeAccessor < Module | |
def initialize(name) | |
@name = name | |
module_eval { define_accessors } | |
end | |
private | |
def define_accessors | |
ivar = "@#{@name}" |
Model.new.foo |
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) |
# 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 |
# 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) |