By: Gk Parish-Philp
Date: June 6th, 2013
Tips and tricksto get the most out of Heroku
- Beginnings
- Why Heroku
%form.comment__form | |
%button Submit | |
%form.product__form | |
%button Submit |
/ person listing page | |
%div#person-list | |
%div.person | |
default | |
%div.person.person--active | |
active | |
%div.person.person--pending | |
pending |
<div id="people-show"> | |
<div class="person"> | |
<h1>This is a Person</h1> | |
</div> | |
</div> | |
<div id="plans-show"> | |
<div class="plan"> | |
<h1>This is a Plan</h1> | |
</div> |
def email_pattern | |
%r{ | |
^[A-Z0-9._%+-]+ # Beginning with one or more valid characters (letters, numbers, period, etc.) | |
@ # A literal "at" sign | |
[A-Z0-9.-]+ # One or more letters, numbers, period, or dash | |
\. # A literal period | |
[A-Z]{2,4}$ # Ending with a two to four character text domain extension | |
}ix # Flags: Ignore whitespace and ignore letter case | |
end |
items = { | |
'a' => 'aardvark', | |
'b' => 'banana', | |
'c' => 'cookies', | |
'd' => 'dog' | |
} | |
criteria = Proc.new { |key, value| value == 'banana' } | |
items.select(&criteria) # => {"b"=>"banana"} | |
items.reject(&criteria) # => {"a"=>"aardvark", "c"=>"cookies", "d"=>"dog"} |
require 'mechanize' | |
# Fetch the home page | |
browser = Mechanize.new | |
home_page = browser.get('https://www.example-aspnet-site.com/') | |
# Fill out the login form | |
login_form = home_page.forms.first | |
login_form.field_with(:name => /UserName/i).value = ARGV[0] | |
login_form.field_with(:name => /Password/i).value = ARGV[1] |
document.write('<iframe src="iframe.html" id="unique-id" onload="resizeIframe();" />') | |
function resizeIframe() { | |
document.getElementById('unique-id').style.height = document.getElementById('unique-id').contentWindow.document.body.offsetHeight + 'px'; | |
} |
require 'httparty' | |
APP_ID = 'nike' | |
BASE_URL = 'https://api.nike.com' | |
class Person | |
def initialize(access_token) | |
self.access_token = access_token | |
end |
#!/usr/bin/env ruby | |
require 'fileutils' | |
# Set Source and Destination | |
source = ARGV[0] || "#{Dir.pwd}/spec/factories.rb" | |
destination = ARGV[1] || "#{Dir.pwd}/spec/factories/" | |
# Verify Source and Destination Exist | |
puts '! Source file does not exist.' unless File.exists?(source) | |
FileUtils.mkpath destination unless File.directory?(destination) |