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 Configuration | |
attr_accessor :tail_logs, :max_connections, :admin_password, :app_server | |
def app_server | |
@app_server ||= AppServerConfiguration.new | |
if block_given? | |
yield(@app_server) | |
end | |
@app_server | |
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
// inherited - bad | |
public MyString extends String { | |
public MyString () { | |
super(); | |
} | |
public String capitalize(String string) { | |
String capString = string.subString(0,1); | |
capString = first.toUpperCase(); |
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
# Example of potential Template pattern implementation: - | |
class Animal | |
def initialize(name, type) | |
@name = name | |
@type = type | |
end | |
def mammal? | |
@type == "mammal" |
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
if ENV['RAILS_ENV'] | |
# Called after the irb session is initialized and Rails has been loaded | |
IRB.conf[:IRB_RC] = Proc.new do | |
#logger = Logger.new(STDOUT) | |
#ActiveRecord::Base.logger = logger | |
#ActiveRecord::Base.connection_pool.clear_reloadable_connections! | |
show_log | |
end | |
def show_log |
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
# This is a basic implementation and is essentially what Rory had. | |
# I just had to prove to myself that it worked. ;) | |
# Decorator pattern is precisely the way to go here. | |
# This is the base class that we want to decorate. | |
# It needs to have a default method for each of the lifecycle events. | |
# i.e. what does it do in the event that there are no products. | |
class Post | |
attr_accessor :products, :featured, :hidden |
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
require 'spec_helper' | |
describe "daemons/index.html.erb", :type => :request do | |
before :each do | |
assign( :daemons, { 'test' => :up } ) | |
render | |
end | |
it "has the correct class" do | |
rendered.should have_css('table tr td.daemon-up') |
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
/* this is a function */ | |
main() | |
{ | |
/* this is a statement */ | |
printf("This C stuff is easy!\n"); | |
/* so is this */ | |
return 0; | |
} |
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
. | |
├── autoload | |
│ ├── pathogen.vim | |
│ └── pathogen.vim.old | |
├── backup | |
├── bundle | |
│ ├── nerdcommenter | |
│ ├── scss-syntax.vim | |
│ ├── snipmate.vim | |
│ ├── supertab |
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
call pathogen#infect() | |
syntax on | |
filetype plugin indent on |
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 Hello | |
def self.first | |
puts "Boo!" | |
end | |
private | |
def self.second | |
puts "Buh!" | |
end |
OlderNewer