This file contains 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
Johnny-Goodmans-MacBook-Pro:Episode3 johnnygoodman$ gem uninstall pg | |
Successfully uninstalled pg-0.13.2 | |
Johnny-Goodmans-MacBook-Pro:Episode3 johnnygoodman$ gem install pg | |
Building native extensions. This could take a while... | |
Successfully installed pg-0.13.2 | |
1 gem installed | |
Installing ri documentation for pg-0.13.2... | |
ERROR: While executing gem ... (ArgumentError) | |
undefined class/module Encoding | |
Johnny-Goodmans-MacBook-Pro:Episode3 johnnygoodman$ bundle install |
This file contains 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
Johnny-Goodmans-MacBook-Pro:Episode3 johnnygoodman$ ruby watchman.rb | |
/Users/johnnygoodman/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1194: [BUG] unknown type 0x22 (0xc given) | |
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0] | |
-- control frame ---------- | |
c:0025 p:---- s:0097 b:0097 l:000096 d:000096 CFUNC :initialize | |
c:0024 p:---- s:0095 b:0095 l:000094 d:000094 CFUNC :new | |
c:0023 p:0020 s:0085 b:0085 l:000084 d:000084 METHOD /Users/johnnygoodman/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter | |
c:0022 p:0119 s:0082 b:0082 l:000081 d:000081 METHOD /Users/johnnygoodman/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter | |
c:0021 p:---- s:0075 b:0075 l:000074 d:000074 FINISH |
This file contains 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 'mechanize' | |
agent = Mechanize.new | |
agent.user_agent_alias = 'Mac Safari' | |
page = agent.get 'https://www.fedex.com/fcl/?appName=fclgfbo&locale=us_en&step3URL=https%3A%2F%2Fwww.fedex.com%2Ffedexbillingonline%2Fregistration.jsp%3FuserRegistration%3DY%26locale%3Den_US&returnurl=https%3A%2F%2Fwww.fedex.com%2Ffedexbillingonline%3F%26locale%3Den_US&programIndicato' | |
form = page.form_with(:name => 'logonForm') | |
form.username = 'user' |
This file contains 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
<?php | |
/** | |
* Send a POST requst using cURL | |
* @param string $url to request | |
* @param array $post values to send | |
* @param array $options for cURL | |
* @return string | |
*/ | |
function curl_post($url, array $post = NULL, array $options = array()) |
This file contains 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 'mechanize' | |
agent = Mechanize.new | |
agent.user_agent_alias = 'Mac Safari' | |
page = agent.get 'https://www.fedex.com/fcl/?appName=fclgfbo&locale=us_en&step3URL=https%3A%2F%2Fwww.fedex.com%2Ffedexbillingonline%2Fregistration.jsp%3FuserRegistration%3DY%26locale%3Den_US&returnurl=https%3A%2F%2Fwww.fedex.com%2Ffedexbillingonline%3F%26locale%3Den_US&programIndicato' | |
form = page.form_with(:name => 'logonForm') | |
form.username = 'user' |
This file contains 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
$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib" | |
require 'automatedjohnny' | |
require 'logger' | |
aj = AutomatedJohnny.new | |
agent = Mechanize.new | |
agent.user_agent_alias = 'Mac Safari' | |
agent.log = Logger.new(STDOUT) | |
page = agent.get 'https://www.fedex.com/fcl/?appName=fclgfbo&locale=us_en&step3URL=https%3A%2F%2Fwww.fedex.com%2Ffedexbillingonline%2Fregistration.jsp%3FuserRegistration%3DY%26locale%3Den_US&returnurl=https%3A%2F%2Fwww.fedex.com%2Ffedexbillingonline%3F%26locale%3Den_US&programIndicato' |
This file contains 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
variants = ["13", "218", "11243", "8324132462", "(832) 413-2462", "832 413 2462", "832-413-2462", "832.413.2462", "123456", "1234567", "123456789", "12345678901"] | |
variants.each_with_index do |number, index| | |
number.gsub!(/^\s+|\s+$/,'') #strip white space | |
number.gsub!(/\D/,'') #strip non-digits | |
if number =~ /^\d+$/ #paranoia check to make sure its all digits | |
case number | |
when /(^[0-9]{2}$)/ | |
puts "#{number} matches two digits" |
This file contains 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 def | |
sum :total_amount, :field_name=>'amount' | |
#call | |
total_amount = ExpenseCubicle.query do | |
select :total_amount | |
end |
This file contains 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
tags = ExpenseCubicle.query do | |
select :tags | |
end | |
pp tags |
This file contains 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
testclasses.rb | |
class Expense | |
include MongoMapper::Document | |
key :expense_id, ObjectId | |
key :amount, Float #FloatToDecimalPrecision | |
key :date, Time | |
key :notes, String | |
key :tags, Array # => company | |
key :type, String |