See how this shows 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
def example(arg=nil) | |
a = [1, 2] | |
return a.reverse if arg | |
a | |
end | |
# OR | |
def example(arg=nil) |
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.configure do |config| | |
config.show_failures_in_pending_blocks = true | |
end | |
describe Array do | |
pending 'slowest' do | |
expect([1, 2, 3].reverse).to eq([2]) | |
end | |
it 'faster' 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
$ highgroove new does-it-work | |
run rails new does-it-work --skip-bundle -T -q -d postgresql from "." | |
run git init -q from "./does-it-work" | |
gsub does-it-work/Gemfile | |
gsub does-it-work/Gemfile | |
append does-it-work/Gemfile | |
run rvm 1.9.3-p125 do rvm --rvmrc --create 1.9.3-p125@does-it-work from "./does-it-work" | |
run rvm 1.9.3-p125@does-it-work do gem install bundler from "./does-it-work" | |
run rvm 1.9.3-p125@does-it-work do bundle install --quiet from "./does-it-work" | |
run rvm 1.9.3-p125@does-it-work do rails g rspec:install from "./does-it-work" |
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 NginxLog | |
[snip] | |
def read | |
raw = read_source | |
raw.extend(Seeder::LazyEnumerable) | |
entries = raw.take_with_block(@count, &:interesting?) | |
raw.map { |entry| parse_entry(entry) } | |
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 install macvim --override-system-vim | |
==> Downloading https://github.com/b4winckler/macvim/tarball/snapshot-64 | |
Already downloaded: /Library/Caches/Homebrew/macvim-7.3-64.tgz | |
==> ./configure --with-features=huge --with-tlib=ncurses --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-pythoninterp --enable-rubyinterp --enab | |
==> cd src/MacVim/icons && make getenvy | |
==> make | |
Starting make in the src directory. | |
If there are problems, cd to the src directory and run make there | |
cd src && make first | |
mkdir objects |
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
Source <a | |
href="http://sunsite.tut.fi/rec/riku/soccer_data/tab/93_94/table.eng0.01_02.html">sunsite.tut.fi/rec/riku/soccer_data/tab/93_94/table.eng0.01_02.html</a> | |
<pre> | |
Team P W L D F A Pts | |
1. Arsenal 38 26 9 3 79 - 36 87 | |
2. Liverpool 38 24 8 6 67 - 30 80 | |
3. Manchester_U 38 24 5 9 87 - 45 77 | |
4. Newcastle 38 21 8 9 74 - 52 71 | |
5. Leeds 38 18 12 8 53 - 37 66 |
The behavior of String#squeeze and String#squeeze! changes from 1.8 to 1.9. You can see the difference in the two code samples below.
irb(main):009:0> `ruby -v`
=> "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.1.0]\n"
irb(main):010:0> s = '--subbookkeeper--'
=> "--subbookkeeper--"
irb(main):011:0> s.squeeze 'z-a'
=> "--subbookkeeper--"
irb(main):012:0> s.squeeze! 'z-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
require File.expand_path('../../../spec_helper', __FILE__) | |
describe "Kernel#is_a?" do | |
it "returns true when object really is in that class" do | |
obj = String.new | |
obj.is_a?(String).should be_true | |
end | |
it "returns true when asked about a superclass" do | |
obj = String.new |
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
Last login: Sat Feb 26 12:06:12 on ttys001 | |
-bash: /Users/charlietanksley/.rvm/scripts/utility: line 457: syntax error near unexpected token `(' | |
-bash: /Users/charlietanksley/.rvm/scripts/utility: line 457: ` \rm -rf "${rvm_tmp_path}/$1"*(N) >/dev/null 2>&1' | |
-bash: __rvm_conditionally_add_bin_path: command not found | |
~ | |
$ rvm list | |
-bash: __rvm_load_rvmrc: command not found | |
-bash: __rvm_initialize: command not found |
NewerOlder