Skip to content

Instantly share code, notes, and snippets.

View holman's full-sized avatar

Zach Holman holman

View GitHub Profile
@holman
holman / README
Created July 21, 2009 09:07 — forked from vangberg/README
# Deploying a Sinatra app to Heroku
## Database
The location of the database Heroku provides can be found in the environment
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example
on how to use this.
## Server
Heroku is serving your apps with thin, with means you have all your thin goodness available,
such as EventMachine.
require 'digest/sha1'
dictionary = ["solo","flex","scalable","rubyonrails","rails","cloud","web","hosting","ec2","aws","git","3des","abbrev","accessor","actionpack","active","activereload","addon","adjoin","aes","agile","ajax","alberti","algol","alias","allen","allman","aloha","amazon","AMI","amp","andreessen","android","apache","apple","applet","apricot","ar","arcade","array","assert","assoc","atbash","atkinson","awk","awsm","awstats","babbage","backus","balancers","bartle","base64","based","bash","bazeries","bdd","beck","becker","behavior","behlendorf","bell","benchmark","benchmarks","berkeleydb","berners","beta","betas","bford","bigdecimal","bignum","bigtable","biham","bin","bina","binaries","binary","bitsweat","bizstone","blank","bletchley","block","blocks","blog","blogs","boole","boolean","bot","box","bricklin","bridge","brin","browser","browsers","bsd","bug","bugs","build","builder","builders","builds","bytesize","c10k","cache","caches","caching","caesar","call","camp","capistrano","cardelli","carmack"
namespace :ci do
task :enqueue do
sleep 60 while FileTest.exists?('tmp/currently_running_tests')
`touch tmp/currently_running_tests`
end
task :dequeue do
`rm tmp/currently_running_tests`
end
@holman
holman / waves.txt
Created October 15, 2009 17:04 — forked from mislav/waves.txt
> This is a Shortwave configuration file
> http://shortwaveapp.com/
>
> Some triggers copied from benpickles (http://gist.github.com/43371)
>
> Urls may contain the following replacement tokens:
>
> %s → search terms
> %r → URL of current page
> %d → domain part of the current URL
@holman
holman / waves.txt
Created October 15, 2009 17:05 — forked from mislav/waves.txt
Shortwave conf
> This is a Shortwave configuration file
> http://shortwaveapp.com/
>
> Some triggers copied from benpickles (http://gist.github.com/43371)
>
> Urls may contain the following replacement tokens:
>
> %s → search terms
> %r → URL of current page
> %d → domain part of the current URL
named_scope :with_city, lambda {|city| city.present? ? {:conditions => {:city => city} : {}}
Search.with_city('Pittsburgh').size # => 2
Search.with_city(nil).size # => all
# Hitting
http://otter.topsy.com/trackbacks.js?callback=jsonp1272404811434&url=http%3A%2F%2Fzachholman.com%2F2010%2F04%2Fapple-is-petrified%2F&perpage=50
# Returns this JSON with only one result:
jsonp1272404811434({"request":{"parameters":{"url":"http://zachholman.com/2010/04/apple-is-petrified/","perpage":"50"},"response_type":"js","resource":"trackbacks","url":"http://button.topsy.com/trackbacks.js?perpage=50&url=http%3A%2F%2Fzachholman.com%2F2010%2F04%2Fapple-is-petrified%2F"},"response":{"page":1,"topsy_trackback_url":"http://topsy.com/tb/zachholman.com/2010/04/apple-is-petrified/","total":1,"perpage":50,"list":[{"permalink_url":"http://twitter.com/alexanderkahn/status/12966881983","date":1272404753,"content":"RT @holman: Why Apple (probably) won't fix iTunes:\n\nhttp://zachholman.com/2010/04/apple-is-petrified","date_alpha":"58 seconds ago","author":{"name":"Alex Kahn","url":"http://twitter.com/alexanderkahn","topsy_author_url":"http://topsy.com/twitter/alexanderkahn","photo_url":"http://a3.twimg.c
@holman
holman / omnicas.rb
Created February 3, 2011 00:05
CAS and OmniAuth
require 'rubygems'
require 'sinatra'
require 'net/https'
require 'omniauth/enterprise'
use OmniAuth::Builder do
provider :CAS, :cas_server => "http://localhost:8080/cas-server-webapp-3.4.5"
end
enable :sessions
puts "YOU ARE NOW SECURE USING RUBY™"
@holman
holman / SAFE-RUBY.rb
Created February 16, 2011 05:38
This shows some of my favorite ways to ensure robust, high-security Ruby Applications.
require 'net/https'
module SecurityModule
class HighSecurity
class ReallyHighSecurity
def self.turn_on_safe_connections
OpenSSL::SSL::VERIFY_NONE
end
end
end