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
| puts "Adding #{size = feed.entries.size} entries" | |
| feed.entries.each { |entry| title_to_entries[entry.title] = entry } | |
| start += size | |
| end | |
| ignored_phrases = ["View my other apartments", "American Realty Pros"] | |
| title_to_entries.reject! do |title, entry| | |
| ignored_phrases.any? { |phrase| entry.summary.include?(phrase) } | |
| 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
| require 'rubygems' | |
| require 'twitter' | |
| require 'twilio-ruby' | |
| last_tweet = Twitter.user_timeline("gglasstheatre").first.text | |
| about_cascabel = last_tweet.include?("#Cascabel") | |
| match = last_tweet.match(/(\d{3}-\d{3}-\d{4})/) | |
| phone_number = match[0].gsub(/-/, '') if match | |
| account_sid = '' |
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 'rspec' | |
| class Foo | |
| def initialize(list); @list = list; end | |
| def method_missing(*args) | |
| @list << args.first | |
| 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
| def bools(n) | |
| generic(n) { rand > 0.5 } | |
| end | |
| def ints(n) | |
| generic(n) { rand(0..10) } | |
| end | |
| def generic(n = rand * 10) | |
| Enumerator.new do |yielder| |
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
| (fn compose [& funcs] | |
| (fn [args] | |
| (reduce (fn [x y] (x (y args))) funcs))) |
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
| board = [[nil, nil, nil], [nil, nil, nil], [nil, nil, nil]] | |
| current_player = 'x' | |
| def game_over? | |
| false | |
| end | |
| def make_move(player, row, col) | |
| board[row][col] = player |
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 'minitest/spec' | |
| require 'minitest/autorun' | |
| # Integer list generation | |
| listOfInt = [1, 3, 5, 7, 9, 11] | |
| left, right = 0, 1 | |
| top, bottom = 2, 3 |
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 'minitest/spec' | |
| require 'minitest/autorun' | |
| # Integer list generation | |
| listOfInt = [1, 3, 5, 7, 9, 11] | |
| left, right = 0, 1 | |
| top, bottom = 2, 3 |
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
| def get_episode_information(filename) | |
| show, season, episode_num = Parser.parse(filename) | |
| puts "#{show} - S#{season} - E#{episode_num}" | |
| @show = @tvdb.fetch_series_from_data(:title => show) | |
| @show.episodes.each do |episode| | |
| if episode.season_number.to_i == season && episode.episode_number.to_i == episode_num | |
| @episode = episode | |
| @episode[:episode_number] = "0" + @episode[:episode_number] if @episode[:episode_number].to_i < 10 | |
| break |
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
| #!/bin/sh | |
| # Don't allow console.log() or 'and show me the page' statements to be committed. | |
| console=`git diff --cached | grep -i 'console\.log' | wc -l` | |
| showme=`git diff --cached | grep -i 'and show me the page' | wc -l` | |
| echo "$console console.log() statments" | |
| echo "$showme 'and show me the page' statements" | |
| echo "" |