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
begin | |
balance = document.css('td.points').text | |
ytd_tqp = document.match('/TQPs<\/abbr><\/a>\s*<\/th>\s*<td>(\d+)<\/td>/')[0] | |
rescue => e | |
puts e.message | |
return {error: "ATTRIBUTES_CHANGED"} | |
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
params = {} | |
document.css('input').each do |input| | |
item = {} | |
item << { input.name => input.value } | |
params.push item | |
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 'reward/starbucks' | |
require 'reward/united' | |
class Reward | |
def initialize params | |
@type = params[:type] | |
@username = params[:username] | |
@password = params[:password] | |
@klass = Object.const_get(@type.capitalize) if Object.const_defined?(@type.capitalize) | |
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 'reward/starbucks' | |
require 'reward/united' | |
class Card | |
def initialize(params) | |
@type = params[:type] | |
@username = params[:username] | |
@password = params[:password] | |
begin | |
@klass = Object.const_get(@type.capitalize) |
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 Reward::Card | |
def initialize(params) | |
@type = params[:type] | |
@username = params[:username] | |
@password = params[:password] | |
@klass = Object.const_get(@type.capitalize) | |
end | |
def reward_balance | |
begin |
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 Reward::Card | |
def initialize(params) | |
@type = params[:type] | |
@username = params[:username] | |
@password = params[:password] | |
end | |
def reward_balance | |
case @type | |
when "starbucks" |
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
FF | |
Failures: | |
1) Creating Projects can create a project | |
Failure/Error: click_link 'New Project' | |
ActionController::ParameterMissing: | |
param not found: project | |
# ./app/controllers/projects_controller.rb:29:in `project_params' | |
# ./app/controllers/projects_controller.rb:6:in `new' |
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
# missing_number_spec.rb | |
# Suppose you have an array of 99 numbers. The array contains the digits 1 to 100 with one digit missing. | |
# Write four different algorithms to compute the missing number. | |
# Two of these should optimize for low storage and two of these should optimize for fast processing. | |
require 'rspec' | |
def missing_number params | |
sum_total = 5050 |
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
chad@zen:~/repos/cybercoders$ rvm current | |
ruby-2.0.0-p247 | |
chad@zen:~/repos/cybercoders$ rvm info | |
ruby-2.0.0-p247: | |
system: | |
uname: "Linux zen 3.11.0-13-generic #20-Ubuntu SMP Wed Oct 23 07:38:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux" | |
system: "ubuntu/13.10/x86_64" | |
bash: "/bin/bash => GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)" |
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
chad@zen:~/repos/cybercoders$ cat /home/chad/.rvm/gems/ruby-2.0.0-p247/bin/rspec | |
#!/usr/bin/env ruby_executable_hooks | |
# | |
# This file was generated by RubyGems. | |
# | |
# The application 'rspec-core' is installed as part of a gem, and | |
# this file is here to facilitate running it. | |
# | |
require 'rubygems' |