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 buildConnectionString(params): | |
| """Build a connection string from a dictionary of parameters | |
| Returns string.""" | |
| return ";".join(["%s=%s" % (k, v) for k, v in params.items()]) | |
| myParams = { | |
| "server": "mpilgrim", | |
| "database": "master", | |
| "uid": "sa", |
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
| affiliate | |
| + referrals | |
| | + referral | |
| | | + player | |
| | | | + rake | |
| | | | + rake | |
| | | + player | |
| | | + rake | |
| | + referral | |
| | | + player |
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 "benchmark" | |
| ITERATIONS = (ARGV[0] || 10000).to_i | |
| def pick(set) | |
| set[rand(set.size)] | |
| end | |
| def trial(method) |
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
| #!/usr/bin/env ruby | |
| require 'net/http' | |
| require 'uri' | |
| require 'json' | |
| response = Net::HTTP.post_form( | |
| URI.parse("http://closure-compiler.appspot.com/compile"), | |
| { | |
| :js_code => STDIN.read, |
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
| cd /data/MyApp/current && /usr/bin/rake some:task |
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
| A contents <<< | |
| send this to a | |
| this goes to a | |
| a, I forgot to add this | |
| <<< | |
| B contents <<< | |
| this goes to b | |
| b, please | |
| <<< |
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
| # your custom search | |
| @search = Product.search(params[:search]) | |
| # searchlogic default | |
| @search = Product.searchlogic(params[:search]) |
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
| RewriteEngine On | |
| RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | |
| RewriteRule ^(.*)$ http://%1/$1 [R=301,L] |
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
| # db/migrate/20101004063749_create_photos.rb | |
| class CreatePhotos < ActiveRecord::Migration | |
| def self.up | |
| create_table :photos do |t| | |
| t.string :name, :null => false | |
| t.binary :data, :null => false | |
| t.string :filename | |
| t.string :mime_type | |
| t.timestamps |
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
| source 'http://rubygems.org' | |
| gem "sinatra" |
OlderNewer