View myFirst.py
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
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", |
View affiliate_tree.txt
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
affiliate | |
+ referrals | |
| + referral | |
| | + player | |
| | | + rake | |
| | | + rake | |
| | + player | |
| | + rake | |
| + referral | |
| | + player |
View monty_hall.rb
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
require "benchmark" | |
ITERATIONS = (ARGV[0] || 10000).to_i | |
def pick(set) | |
set[rand(set.size)] | |
end | |
def trial(method) |
View Compile.tmCommand
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
#!/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, |
View correct_crontab.sh
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
cd /data/MyApp/current && /usr/bin/rake some:task |
View advanced_output
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
A contents <<< | |
send this to a | |
this goes to a | |
a, I forgot to add this | |
<<< | |
B contents <<< | |
this goes to b | |
b, please | |
<<< |
View access_default_search.rb
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
# your custom search | |
@search = Product.search(params[:search]) | |
# searchlogic default | |
@search = Product.searchlogic(params[:search]) |
View .htaccess
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
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | |
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] |
View 20101004063749_create_photos.rb
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
# 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 |
View Gemfile
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
source 'http://rubygems.org' | |
gem "sinatra" |
OlderNewer