This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Car { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
attr_accessor :first_name, :surname | |
@first_name = 'zak' | |
@surname = 'grant' | |
class << self | |
def new(options={}) | |
Person.new options | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
module A | |
def say_hello name | |
puts "Hello #{name}" | |
end | |
end | |
class B | |
include A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ToHaml | |
def initialize(path) | |
@path = path | |
end | |
def convert! | |
Dir["#{@path}/**/*.erb"].each do |file| | |
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}` | |
`rm -Rf #{file}` | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
wget http://rubyforge.org/frs/download.php/74596/ruby_core_source-0.1.5.gem | |
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem | |
wget http://rubyforge.org/frs/download.php/63094/ruby-debug19-0.11.6.gem | |
wget http://rubygems.org/downloads/ruby-debug-ide-0.4.17.beta8.gem | |
wget http://rubyforge.org/frs/download.php/64707/ruby-debug-ide19-0.4.12.gem | |
export RVM_SRC=~/.rvm/src/ruby-1.9.3-p0 | |
gem install linecache19-0.5.13.gem -- --with-ruby-include=$RVM_SRC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'hpricot' | |
require 'ruby_parser' | |
require 'optparse' | |
class ToHaml | |
def initialize(path) | |
@path = path | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew update | |
brew install rbenv | |
brew install ruby-build | |
gem install rbenv-rehash | |
gem install bundler | |
git clone -- [email protected]:carsomyr/rbenv-bundler ~/.rbenv/plugins/bundler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car < ActiveRecord::Base | |
belongs_to :owner | |
belongs_to :previous_owner, class_name: "Owner" | |
def owner(new_owner) | |
self.previous_owner = owner | |
super | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# using the picasa gem => https://github.com/morgoth/picasa | |
require "picasa" | |
# delete all albums for an account. | |
begin | |
client = Picasa::Client.new(:user_id => $INSERT_GOOGLE_USER_NAME_HERE, :password => $INSERT_PASSWORD_HERE) | |
client.album.list.entries.each do |album| | |
client.album.delete(album.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "picasa" | |
# delete all albums. | |
begin | |
client = Picasa::Client.new user_id: $USER_ID, password: $PASSWORD | |
albums = client.album.list.entries | |
albums.each do |album| |
OlderNewer