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
# Don't you feel like doing something like this when you use Ripple? | |
# Obviously there's more to it than this mockup, but man this would | |
# be nice, wouldn't it? | |
module Ripple | |
class Document | |
def self.method_missing(method, args) | |
if method.to_s =~ /^find_by_(.*)$/ | |
return find_by_index($1.to_sym, *args) | |
end | |
super |
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
# Generate a token by looping and ensuring does not already exist. | |
def generate_token(column) | |
loop do | |
token = Devise.friendly_token | |
break token unless to_adapter.find_first({ column => token }) | |
end | |
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
signature = "" | |
signature << "id=#{id}" | |
signature << "carrier=#{carrier}" | |
signature << "wireless_number=#{wireless_number}" | |
signature << "status=#{status}" | |
signature << "secret=#{PUBLICATION_SECRET}" | |
signature = Digest::SHA1.hexdigest(signature) | |
puts signature |
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
swb-mbp% knife cookbook upload apache2 | |
Uploading apache2 [1.1.12] | |
/Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock': Connection reset by peer (Errno::ECONNRESET) | |
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/openssl/buffering.rb:174:in `read_nonblock' | |
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill' | |
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' | |
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' | |
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line' | |
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2551:in `read_new' | |
from /Users/scottwb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request' |
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
{ | |
"candidate" : { | |
// Required Fields | |
"firstName" : "Scott", | |
"lastName" : "Bradley", | |
"email" : "scottwb@example.com", | |
"currentPosition" : "VP of Engineering", | |
"currentCompany" : "Validas, LLC", | |
"location" : "Kirkland, WA", | |
"message" : "You should hire me because...", // markdown |
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
{ | |
// Required Fields | |
"firstName" : "Scott", | |
"lastName" : "Bradley", | |
"email" : "scottwb@example.com", | |
"currentPosition" : "VP of Engineering", | |
"currentCompany" : "Validas, LLC", | |
"location" : "Kirkland, WA", | |
"message" : "You should hire me because...", // markdown | |
"resume" : "http://...", |
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
swb-mbp% curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"candidate":{"firstName":"Scott","lastName":"Bradley","email":"scottwb@validas.com","currentPosition":"VP of Engineering","currentCompany":"Validas, LLC","location":"Kirkland, WA","message":"You should hire me because...","resume":"http://....","position":"linux","twitter":"@scottwb69","github":"scottwb","website":"http://scottwb.com/","blog":"http://scottwb.com/","otherLink1":"http://foo.com/","otherLink2":"http://bar.com/","test":true}}' http://jobsapi.validas.com/candidates.json | |
* About to connect() to jobsapi.validas.com port 80 (#0) | |
* Trying 23.22.208.238... connected | |
* Connected to jobsapi.validas.com (23.22.208.238) port 80 (#0) | |
> POST /candidates.json HTTP/1.1 | |
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5 | |
> Host: jobsapi.validas.com | |
> Accept: application/json | |
> Content-type: application/json | |
> Content-Length: 444 |
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
wb-mbp% whereis gcc | |
/usr/bin/gcc | |
swb-mbp% gcc --version | |
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) | |
Copyright (C) 2007 Free Software Foundation, Inc. | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
swb-mbp% /usr/bin/gcc-4.2 --version | |
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) |
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
namespace :coffee do | |
task :compile, :filename do |t, args| | |
filename = args.filename | |
puts CoffeeScript.compile(File.open(filename)) | |
end | |
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
// Gracefully handle AddThis hashes with jQuery Mobile | |
$(function() { | |
if (window.location.hash != '') { | |
window.location.href = window.location.href.split('#')[0]; | |
} | |
}); |