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
| PS1=" ${RUBY_PROMPT}${YELLOW}\w\a${NO_COLOR} (${PROMPT_COLOR}${BRANCH}${NO_COLOR}${STATE}${NO_COLOR})\n⤷ " |
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
| $ git clone https://github.com/rspec/rspec-core.git | |
| $ git clone https://github.com/rspec/rspec-expectations.git | |
| $ git clone https://github.com/rspec/rspec-mocks.git | |
| $ mate rspec-mocks rspec-expectations rspec-core |
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
| require 'rubygems' | |
| require 'eventmachine' | |
| module HttpHeaders | |
| def post_init | |
| send_data "GET /\r\n\r\n" | |
| @data = "" | |
| end | |
| def receive_data(data) |
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
| require 'rubygems' | |
| require 'eventmachine' | |
| require 'em-http' | |
| require 'json' | |
| EM.run do | |
| username = "username" | |
| password = "secret" | |
| term = "ruby" | |
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
| require 'rubygems' | |
| require 'eventmachine' | |
| module ChatClient | |
| def self.list | |
| @list ||= [] | |
| end | |
| def post_init | |
| @name = "anonymous_#{rand(99999)}" |
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 Array | |
| alias :delete_all :delete | |
| undef :delete | |
| def delete(element) | |
| each_with_index do |index, element_of_array| | |
| delete_at(index) if element == element_of_array | |
| 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
| class MyArray < Array | |
| alias :delete_all :delete | |
| undef :delete | |
| def delete(element) | |
| each_with_index do |index, element_of_array| | |
| delete_at(index) if element == element_of_array | |
| 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
| void integer_to_char(long long value, char* str, int base) { | |
| static char num[] = "0123456789abcdefghijklmnopqrstuvwxyz"; | |
| char *wstr = str; | |
| int sign; | |
| lldiv_t res; | |
| // Validate base | |
| if (base < 2 || base > 35) { | |
| *wstr = '\0'; | |
| return; |
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
| ### HAML AND DATAMAPPER ###### | |
| ### Assuming that @episodes is: | |
| # | |
| # [#<Episode @id=1 @title="Cache Variable">, #<Episode @id=2 @title="Cache Variable"> , #<Episode @id=3 @title="Cache Variable">] | |
| # | |
| #current_episode |
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
| ### HAML AND DATAMAPPER ###### | |
| ### Assuming that @episodes is: | |
| # | |
| # [#<Episode @id=1 @title="Cache Variable">, #<Episode @id=2 @title="Cache Variable"> , #<Episode @id=3 @title="Cache Variable">] | |
| # | |
| #current_episode | |
| - unless @episodes.empty? |