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
# general dependencies | |
sudo apte-get update | |
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties | |
# git | |
sudo apt-get install curl git-core bash-completion | |
# rbenv in one go | |
curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash | |
# bashrc + rbenv |
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
Page.delete_all | |
Node.delete_all | |
p = Page.new(:name => "testbild") | |
root = Box.new(:height => 400, :width => 600) | |
grid1 = Grid.new(:height => 400, :width => 300, :align => "left") | |
grid2 = Grid.new(:height => 400, :width => 300, :align => "right") | |
grid3 = Grid.new(:height => 200, :width => 300, :align => "top") | |
grid4 = Grid.new(:height => 200, :width => 300, :align => "bottom") |
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
results = [] | |
# 3 | |
results << class A | |
def initialize | |
@a = 11 | |
@@a = 22 | |
a = 33 | |
end | |
@a = 1 |
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 I | |
def like arg | |
puts "%s %s %s" % [self.class, self.class.instance_methods(false), arg] | |
end | |
end | |
c, m, arg = gets.split # input 'I like metaprogramming.' | |
puts | |
# If I can't modify the like method itself, let's modify what it calls |
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 I | |
def like arg | |
puts "%s %s %s" % [self.class, self.class.instance_methods(false), arg] | |
end | |
end | |
c, m, arg = gets.split # input 'I like metaprogramming.' | |
puts | |
# If I can't modify the like method itself, let's modify what it calls |
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
# MaskedString = Class.new(String) | |
Object.const_set("MaskedString", Class.new(String)) | |
MaskedString.instance_eval do | |
define_method :tr_vowel do | |
tr 'aeiou', '*' | |
end | |
end | |
MaskedString.class_eval do |
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
- wrap(true) | |
%p | |
Wrap Me! | |
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
module ActionView | |
module Template::Handlers | |
class ErSass < ERB | |
def compile(template, local_assigns = {}) | |
erbsrc = "<% __in_erb_template=true %>#{template.source}" | |
erboutput = self.class.erb_implementation.new(erbsrc, :trim => (self.class.erb_trim_mode == "-")).src | |
erboutput + ";Sass::Engine.new(@output_buffer.to_s, {:load_paths => ['.', 'app/stylesheets']}).render" | |
end | |
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
application.rb: | |
# Enable the asset pipeline | |
config.assets.enabled = true | |
# Version of your assets, change this if you want to expire all your assets | |
config.assets.version = '1.0' | |
development.rb |
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
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
OlderNewer