This file contains hidden or 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
| set nocompatible | |
| filetype off | |
| silent! call pathogen#runtime_append_all_bundles() | |
| filetype plugin indent on | |
| runtime macros/matchit.vim | |
| set hidden | |
| set autoread | |
| set nobackup | |
| set noswapfile |
This file contains hidden or 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
| irb(main):001:0> Month = Struct.new(:year, :month) | |
| => Month | |
| irb(main):002:0> Month.new(1) | |
| => #<struct Month year=1, month=nil> |
This file contains hidden or 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
| run-command-on-git-revisions 353ca58a031a9138b7fb58dc7d3598e2c1711e3e master 'find application/controllers -name "*.php" -print | xargs wc -l | sort -n | tail -2' | |
| => git rev-list --reverse 353ca58a031a9138b7fb58dc7d3598e2c1711e3e..master | |
| Checking out: 41b3ab4 Set up template | |
| => git checkout --quiet 41b3ab4f711c59a3d99b222702f6769b87c31245 | |
| => find application/controllers -name "*.php" -print | xargs wc -l | sort -n | tail -2 | |
| find: |: unknown option |
This file contains hidden or 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
| set nocompatible | |
| filetype off | |
| silent! call pathogen#runtime_append_all_bundles() | |
| filetype plugin indent on | |
| runtime macros/matchit.vim | |
| set hidden | |
| set autoread | |
| set nobackup | |
| set noswapfile |
This file contains hidden or 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 MyObject | |
| def self.my_attr_reader(*args) | |
| args.each do |method_name| | |
| class_eval do | |
| define_method(method_name) do | |
| self.instance_variable_get("@#{method_name}") | |
| end | |
| end | |
| end | |
| end |
This file contains hidden or 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
| step1specs = describe "removing implication" [ | |
| it "removes a simple implication" | |
| (Disj (Not (Atom "A")) (Atom "B") `eql` (eliminateImplications $ Imp (Atom "A") (Atom "B"))) | |
| ] |
This file contains hidden or 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
| # Turn the first block of code into the second one | |
| # Starting on the 'r' of return | |
| def add(string) | |
| if /,/.match string | |
| return string.split(',').map(&:to_i).inject(0, &:+) | |
| end | |
| if string.empty? | |
| 0 | |
| else | |
| string.to_i |
This file contains hidden or 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
| valid = some_method_to_set_valid() | |
| status = error_message_from_valid_flag(valid) | |
| def error_message_from_valid_flag(valid) | |
| if valid == 1: | |
| return "VALIDATED" | |
| elif valid == 0: | |
| return "INVALID" | |
| elif valid == -1: | |
| return "UNINITIALIZED_ERROR" |
This file contains hidden or 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
| DestroysAllSoftware.byTypingFast becomes | |
| DestroyAllSoftware.byTypingFast | |
| SubscribesUsers.to(screencasts) becomes | |
| SubscribeUsers.to(screencasts) | |
| etc |
This file contains hidden or 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
| >> foo = 1 | |
| >> x = lambda { if foo == 0; return foo; else; foo = foo - 1; x.call; end } | |
| => #<Proc:0x0000000106b9bd40@(irb):16> | |
| >> x.call | |
| => 0 |