Skip to content

Instantly share code, notes, and snippets.

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import junitx.framework.AssertionFailedError;
import org.junit.Assert;
@brianstorti
brianstorti / backup.rb
Created September 3, 2011 20:18
Backup configuration file
Backup::Model.new(:backup_name, 'Description') do
##
# PostgreSQL [Database]
#
database PostgreSQL do |db|
db.name = "db_name"
db.username = "username"
db.password = "password"
db.host = "host"
@brianstorti
brianstorti / lyrics.rb
Created September 11, 2011 21:14
Lyrics
USAGE
ruby lyrics.rb "Bob Dylan" "Tangled Up In Blue"
@brianstorti
brianstorti / gist:1232506
Created September 21, 2011 16:15
import_dump dependency
sudo apt-get install ruby rubygems libopenssl-ruby
sudo gem install net-ssh net-scp
@brianstorti
brianstorti / gist:1266371
Created October 6, 2011 02:50
Steve Jobs quote
No one wants to die. Even people who want to go to heaven don’t want to die to get there.
And yet death is the destination we all share. No one has ever escaped it. And that is as
it should be, because Death is very likely the single best invention of Life. It is Life’s
change agent. It clears out the old to make way for the new. Right now the new is you, but
someday not too long from now, you will gradually become the old and be cleared away.
Sorry to be so dramatic, but it is quite true.
Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by
dogma — which is living with the results of other people’s thinking. Don’t let the noise
of others’ opinions drown out your own inner voice. And most important, have the courage
@brianstorti
brianstorti / gist:1272680
Created October 8, 2011 18:35
Twitter bootstrap with rails 3.1
Gemfile
gem 'twitter-bootstrap-rails'
gem 'less'
gem 'less-rails', :git => 'git://github.com/metaskills/less-rails.git'
applications.css
/*
*= require bootstrap
http://www.tahititatou.com/db_therock-front-021.jpg
http://www.westlord.com/wp-content/uploads/2010/09/Dwayne-Johnson-Body-Tattoo.jpg
http://www.sabendoagora.com/wp-content/uploads/2011/10/tatuagem-dwayne-johnson-foto2.jpg
http://www.tahititatou.com/db_therock-side-081.jpg
http://4.bp.blogspot.com/-_wX3VVkRVMM/TZrXCrCYk4I/AAAAAAAADvc/jNb_rjGZ6ec/s1600/the_rock_tattoos_dwayne_johnson%2527s_tattoo_wwe+1.jpg
http://farm2.static.flickr.com/1426/1487268100_c2171809c9.jpg
http://www.tatuagem.com.br/images/stories/maori-edmundo-.jpg
http://farm4.static.flickr.com/3398/3454290949_423e72b9a2.jpg
http://www.extrapolando.com/wp-content/uploads/2010/10/tatuagens-de-maori.jpg
require 'test/unit'
module Kernel
def using(resource)
begin
yield if block_given?
ensure
resource.dispose
end
end
@brianstorti
brianstorti / class.rb
Created November 8, 2011 23:33
Defining a class w/o the class keyword
#with class
class MyClass < Array
def my_method
"w00t"
end
end
#without class
MyClass = Class.new(Array) do
def my_method
@brianstorti
brianstorti / class_variable.rb
Created November 8, 2011 23:47
Ruby class variable
class A
@@var = "a"
def test
@@var
end
end
class B < A
@@var = "b"