Skip to content

Instantly share code, notes, and snippets.

View levinalex's full-sized avatar

Levin Alexander levinalex

View GitHub Profile
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi
source /usr/local/git/contrib/completion/git-completion.bash
complete -cf sudo
GIT_PS1_SHOWDIRTYSTATE=true
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
def foo(*args)
p args
end
foo(<<ONE,<<TWO, "three") #=> ["one\n","two\n",three"]
one
ONE
two
TWO
# this is an ugly hack
When /^the spinx index is updated$/ do
ThinkingSphinx::Configuration.instance.build
unless ThinkingSphinx.sphinx_running?
`rake ts:config ts:index ts:run RAILS_ENV=test`
end
assert ThinkingSphinx.sphinx_running?
#!/usr/bin/env ruby
require 'rubygems'
require 'net/https'
require 'uri'
require 'json'
require 'enumerator'
require "daemons"
# EDIT POST_RECEIVE_URL
class Object
def if_empty
yield if empty?
self
end
end
task :rebuild_config => :app_env do
config = ThinkingSphinx::Configuration.instance
file config.config_file do |f|
puts "Regenerating Configuration to #{config.config_file}"
config.build
end
Rake::Task[config.config_file].invoke
end
task :start => :rebuild_config
Postgres: 8.3.5
Ruby: 2.3.2
Postgres-Adapter: pg (0.8.0)
on OS X 10.5
$ psql
Welcome to psql 8.3.5, the PostgreSQL interactive terminal.
postgres=# CREATE TABLE widgets ( name varchar, amount integer, size integer, weight integer);
#!/usr/bin/env ruby
#
# written while macports compiles gnome stuff in order to install ffmpeg
#
# usage: portgraph <portname>
#
# $ ./portgraph ffmpeg > tmp.dot && dot -T pdf tmp.dot > out.pdf && open out.pdf
#
# if you want something that actually works:
# http://svn.macports.org/repository/macports/contrib/port-rdeps/port-rdeps
$ irb
>> class Foo
>> def self.bob=(v)
>> @bob = v
>> end
>> def self.bob
>> @bob
>> end
>> end
=> nil