Skip to content

Instantly share code, notes, and snippets.

View cayblood's full-sized avatar

Carl Youngblood cayblood

View GitHub Profile
@cayblood
cayblood / gist:981779
Created May 19, 2011 21:22
lilypond example
\version "2.13.52"
melody = \relative c'' {
\clef treble
\key a \major
\override Staff.TimeSignature #'style = #'()
\time 4/4
\autoBeamOn
\partial 4 s4 |
@cayblood
cayblood / gist:1440190
Created December 6, 2011 21:54
example of using the ruby sequel gem to access a sqlite3 database on jruby
#############################################################################
# to use this in jruby:
#
# jgem install sequel
# jgem install jdbc-sqlite3
#
# for more info on the sequel library, go to http://sequel.rubyforge.org/
#############################################################################
require 'rubygems'
@cayblood
cayblood / gist:1450729
Created December 9, 2011 08:24
My .bash_profile
#!/bin/sh
export MAKE_J=4
export EDITOR='mate'
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
export JAVA_HOME=$(/usr/libexec/java_home)
export M2_HOME="/usr/local/Cellar/maven/3.0.3/libexec"
export M2="$M2_HOME/bin"
export MAVEN_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=512m"
@cayblood
cayblood / gist:1486283
Created December 16, 2011 14:38
capybara setup in cucumber
Capybara.run_server = false
[:firefox, :chrome, :ie].each do |browser|
Capybara.register_driver "selenium_#{browser}".to_sym do |app|
Capybara::Selenium::Driver.new(app, :browser => browser)
end
Capybara.register_driver "selenium_remote_#{browser}".to_sym do |app|
host = ENV['SELENIUM_HOST']
options = {
:browser => :remote,
@cayblood
cayblood / DotFont.lua
Created December 24, 2011 09:40
Codea game - Tank Wars
function setup()
    font = DotFont()
    color = {{255, 0, 0}, {255, 255, 0}}
end
function draw()
    background(7, 7, 7, 255)
    
    rectMode(CORNER)
@cayblood
cayblood / db_nuke.rake
Created February 7, 2012 08:12
DB Nuke task for rails - deletes all your database tables and reruns your migrations
namespace :db do
task :nuke => :environment do
abcs = ActiveRecord::Base.configurations
["development", "test"].each do |db|
case abcs[db]["adapter"]
when "oci"
ActiveRecord::Base.establish_connection(db.to_sym)
conn = ActiveRecord::Base.connection
conn.begin_db_transaction
conn.tables.each do |table|
@cayblood
cayblood / presentation.rb
Created February 7, 2012 08:12 — forked from jimweirich/presentation.rb
Vital Ruby Lab 3
class Array
def sum
inject(0.0) { |result, el| result + el }
end
def mean
sum / size
end
end
@cayblood
cayblood / x.rb
Created February 7, 2012 11:58 — forked from jimweirich/x.rb
Vital Ruby my_each
class Array
def my_each
length.times do |index|
yield(self[index])
end
end
def my_inject(initial_value)
accumulator = initial_value || self.dup.shift
my_each do |item|
@cayblood
cayblood / Rakefile
Created February 7, 2012 13:54 — forked from jimweirich/presentation.rb
Vital Ruby Lab 4
require 'processor.rb'
task :parse do
p = Processor.new
p.parse
end
task :default => :parse
@cayblood
cayblood / presentation.rb
Created February 8, 2012 08:57 — forked from jimweirich/read_only_proxy.rb
Vital Ruby Lab 5
class Array
def sum
inject(0.0) { |result, el| result + el }
end
def mean
sum / size
end
end