Skip to content

Instantly share code, notes, and snippets.

View Solnse's full-sized avatar

Chad Solnse

View GitHub Profile
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
params = {}
document.css('input').each do |input|
item = {}
item << { input.name => input.value }
params.push item
end
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
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)
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
class Reward::Card
def initialize(params)
@type = params[:type]
@username = params[:username]
@password = params[:password]
end
def reward_balance
case @type
when "starbucks"
@Solnse
Solnse / error
Last active August 29, 2015 13:58
rspec error
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'
# 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
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)"
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'