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
| if options[:fast] | |
| options[:ignorecase] ? pattern = Regexp.new(Regexp.escape(ARGV.shift), 1) : pattern = Regexp.new(Regexp.escape(ARGV.shift)) | |
| elsif options[:ignorecase] | |
| pattern = Regexp.new(ARGV.shift, 1) | |
| else | |
| pattern = Regexp.new(ARGV.shift) | |
| 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
| # Inserting the regular expression in to the conditional statement. line is the lambda |line|, as part of | |
| # an iteration. | |
| if line =~ /#{pattern}/ |
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
| #!/usr/bin/env ruby -w | |
| require 'optparse' | |
| require 'open-uri' | |
| class PowerGrep | |
| def initialize | |
| @results => "Initialized!" | |
| 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
| lastfm_call = Nokogiri::XML(open("http://ws.audioscrobbler.com/2.0/?method=track.getsimilar&artist=#{artist}&track=#{track}&api_key=#{@api_key}")) |
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 'test_helper' | |
| class CartTest < ActiveSupport::TestCase | |
| test "initialize" do | |
| cart = Cart.new | |
| assert_equal 0, cart.items.length | |
| end | |
| test "add product" do |
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
| test "should create user" do | |
| assert_difference('User.count') do | |
| post :create, :user => { | |
| :name => "Bob Smith", | |
| :password => "test", | |
| :password_confirmation => "test" | |
| } | |
| end | |
| assert_redirected_to :action => 'index' |
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 | |
| # | |
| # Will append the current Lighthouse ticket number to the commit message automatically | |
| # when you use the 1234-foo-bar branch naming convention. | |
| # | |
| # Drop into .git/hooks/commit-msg | |
| # chmod +x .git/hooks/commit-msg | |
| exec < /dev/tty |
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 Group < ActiveRecord::Base | |
| belongs_to :location | |
| validates_presence_of :name, :location_id | |
| def self.sort(page, order) | |
| options = {} | |
| if order == 'location' | |
| options[:order] = 'location_id' |
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 | |
| # | |
| # Will append the current Lighthouse ticket number to the commit message automatically | |
| # when you use the 1234-foo-bar branch naming convention. | |
| # | |
| # Drop into .git/hooks/commit-msg | |
| # chmod +x .git/hooks/commit-msg | |
| exec < /dev/tty |
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 Event < ActiveRecord::Base | |
| belongs_to :group | |
| belongs_to :location | |
| validates_presence_of :group_id, :location_id, :start_time, :end_time | |
| define_index do | |
| indexes name | |
| end | |
| end |
OlderNewer