Skip to content

Instantly share code, notes, and snippets.

View wrburgess's full-sized avatar
:shipit:
Shippin'

Randy Burgess wrburgess

:shipit:
Shippin'
View GitHub Profile
@wrburgess
wrburgess / nokogiri_parse_xml_example.rb
Created March 2, 2012 20:38
Nokogiri parse XML example
doc = Nokogiri::XML(res.body)
@doc = doc.xpath('//mdn').each do |record|
@carriercode = record.at('@carrier').text
end
@carriercode
@wrburgess
wrburgess / authorization example
Created March 3, 2012 13:13
Chrome Advanced Rest API Client for Testing and Catapult
Authorization: Firm username:password
@wrburgess
wrburgess / setting_up_active_admin_on_heroku.md
Created March 4, 2012 22:31
Rails App with ActiveAdmin on Heroku #rails #ruby #activeadmin #heroku
@wrburgess
wrburgess / gist:2004212
Created March 8, 2012 23:53
Excel Formulas
="http://example.com/" & SUBSTITUTE(R12, "#", "")
@wrburgess
wrburgess / gist:2005331
Created March 9, 2012 06:24
Tracking Facebook and Twitter Events with Google Analytics #googleanalytics #social #facebook #twitter
For more info:
http://code.google.com/apis/analytics/docs/tracking/gaTrackingSocial.html
http://www.socialmediaexaminer.com/how-to-track-tweets-facebook-likes-and-more-with-google-analytics/
Place between <head></head> tags:
<head>
@wrburgess
wrburgess / gist:2012625
Created March 10, 2012 19:30
ruby case/when example #ruby #example #logic #structure #case
variable = 'something'
case variable
when some_string.match(/\d/)
puts 'String has numbers'
when some_string.match(/[a-zA-Z]/)
puts 'String has letters'
else
puts 'String has no numbers or letters'
end
@wrburgess
wrburgess / gist:2044461
Created March 15, 2012 14:27
Rails Migrations #rails #ruby #migrations #activerecord

##References

##Create Empty Migration command:

rails generate migration MyNewMigration

##Empty Migration Example


 class TenderloveMigration < ActiveRecord::Migration
@wrburgess
wrburgess / gist:2081209
Created March 18, 2012 20:46
TomDoc examples #template #tomdoc #documentation
# reference: http://tomdoc.org/
# Public: Add two numbers together.
#
# value1 - The first number.
# value2 - The second number.
#
# Examples
#
# add(1, 2)
@wrburgess
wrburgess / gist:2086949
Created March 19, 2012 00:20
Setting up New Relic for Sinatra on Heroku #newrelic #sinatra #heroku
@wrburgess
wrburgess / gist:2170970
Created March 23, 2012 14:10
Parse json to csv in ruby
require 'csv'
require 'json'
csv_string = CSV.generate do |csv|
JSON.parse(File.open("filename.json").read).each do |hash|
data = hash[1]
theline = theline + " #{data},"
end
end