Skip to content

Instantly share code, notes, and snippets.

View richo's full-sized avatar

richö butts richo

View GitHub Profile
@richo
richo / .vimrc
Created May 6, 2011 04:08 — forked from ConradIrwin/.vimrc
# Comment vim text-object
function! SelectComment()
let curindent = indent(".")
let commstr = &commentstring[0]
" bail if not a comment
if getline(".")[curindent] != commstr
return
endif
" find the first commented line
@richo
richo / RecursiveFileSearch
Created May 9, 2011 05:26
vimscript - Don't search in dumb places
" Original Authoer Araxia@Freenode/#vim
function! RecursiveFileSearch(callback) " {{{
let bad_paths = '^\(' . expand('~') . '\|' . expand('/') .'\)$'
if match(getcwd(), bad_paths) > -1
echo printf("Are you kidding? You want to recursively search in '%s'?", getcwd())
else
exe a:callback
end
endf
@richo
richo / gist:969695
Created May 12, 2011 23:47 — forked from defunkt/gist:206253
unicorn sample configuration
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
# Set by set_env anyway
rails_env = ENV['RAILS_ENV'] || 'production'
# 4 workers in testing and 1 master
worker_processes (rails_env == 'production' ? 4 : 1)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
@richo
richo / gist:1050306
Created June 28, 2011 01:45
My asoundrc for defaulting to a USB headset
pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}
@richo
richo / home.profile
Created August 24, 2011 12:30
RVM's default config on debian stable
#!/bin/sh
[ -z "$have_rvm" ] &&
source /etc/profile.d/rvm.sh
@richo
richo / git.py
Created September 2, 2011 14:57
import ourgit
class GitModule(BawtM2):
_name = "GitModule"
privmsg_re = "^(!|%(nick)s:\s+)git ?([^ ].*)"
def handle_privmsg(self, msg):
if self.auth(msg.nick):
cmd = 'git ' + self.m.group(2)
if cmd:
self.parent.privmsg(msg.replyto, ourgit.oneline(cmd))
class Thing(object):
def __init__(_, data):
print("I use _ for my instances, because fucking with people is great")
_.data = data
def get_data(_):
print(_.data)
b = Thing("rawr!")
b.get_data()
module Twat::Endpoints
class Identica
def initialize
module Twitter
module Request
def request(method, path, params, options)
path.gsub!(%r|^/1|, '')
super(method, path, params, options)
end
module Twat::Endpoints
class Identica
def initialize
::Twitter.module_eval do
Request.module_eval do
def request(method, path, params, options)
path.gsub!(%r|^/1|, '')
super(method, path, params, options)
end
module Twat::Endpoints
class Identica
def initialize
::Twitter::Request.module_eval do
def request(method, path, params, options)
# Needs original method body, seems to be impossible to call original
# implementation
# FIXME subclass the whole show?
path.gsub!(%r|^1/|, '')