This file contains hidden or 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 'nokogiri' | |
namespace :amazon do | |
desc 'Download XSD files recursively' | |
task xsd: :environment do | |
dest = download_xsd_file( | |
'amzn-envelope.xsd', | |
'https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/xsd/release_1_9/' | |
) | |
# Validate schema |
This file contains hidden or 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
# When inspecting a BigDecimal in the console, default to | |
# printing it as a float. This is purely cosmetetic and | |
# is easier to read compared to scientific notation. | |
# | |
# Before: | |
# [1] pry(main)> d = BigDecimal.new(10) | |
# => 0.1e2 | |
# | |
# After: | |
# [1] pry(main)> d = BigDecimal.new(10) |
This file contains hidden or 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
def create | |
digest = OpenSSL::Digest.new('sha256') | |
hmac = OpenSSL::HMAC.digest(digest, ENV['QUICKBOOKS_VERIFIER'], request.body.read) | |
base64 = Base64.encode64(hmac).strip | |
if base64 == request.headers['intuit-signature'] | |
# valid! | |
render nothing: true, status: 201 | |
else | |
# not valid! | |
render text: 'Invalid signature', status: 400 |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>homebrew.mxcl.mysql</string> | |
<key>ProgramArguments</key> | |
<array> |
This file contains hidden or 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
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] | |
/Users/gregwoods/Source/*/*/log/*.log 644 3 256 * G | |
/Users/gregwoods/Source/*/*/spec/dummy/log/*.log 644 3 256 * G | |
/Users/gregwoods/.rvm/*/*/*.log gregwoods:staff 644 1 10 * G |
This file contains hidden or 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 :git_sync do | |
namespace :push do | |
desc 'Push public/system files to staging' | |
task :staging => :environment do | |
do_rsync_push('staging') | |
end | |
desc 'Push public/system files to production' | |
task :production => :environment do | |
do_rsync_push('production') |
This file contains hidden or 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
// Playground - noun: a place where people can play | |
import Cocoa | |
@class_protocol protocol DownloaderDelegate { | |
func finishedDownloading(fileName: String) | |
} | |
class Downloader { | |
weak var delegate: DownloaderDelegate? |
This file contains hidden or 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 ApplicationController < ActionController::Base | |
before_filter :delete_if_none_match_header | |
private | |
# Encountered bug where Safari 7 would fail to render pages when ETAG-based caching kicks in | |
# This should prevent Safari from attempting such caching | |
def delete_if_none_match_header | |
if request.format.html? && request.headers['If-None-Match'] != nil && is_safari?() |
This file contains hidden or 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 Foo | |
end | |
Foo.send(:define_method, "💩") do | |
puts "Hello, World!" | |
end | |
f = Foo.new() | |
f.send(:💩) |
This file contains hidden or 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
#!/bin/bash | |
websites=/srv/sites | |
cd $websites | |
for dir in $(find . -maxdepth 1 -type d) | |
do | |
cd $dir | |
pwd | |
bundle install --deployment | |
cd $websites |
NewerOlder