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 'rubygems' | |
| require 'active_record' | |
| desc 'migrate legacy table to add column' | |
| namespace :document_manager do | |
| namespace :db do | |
| task :migrate do | |
| ActiveRecord::Base.clear_active_connections! | |
| configs = open('config/database.yml') { |f| YAML.load(f) } | |
| ActiveRecord::Base.logger = Logger.new(STDOUT) |
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
| #calling view | |
| <%= growl4rails_includes(3000, 5) %> | |
| <%= | |
| periodically_call_remote( | |
| :url => '/foos/loading_statuses.js', | |
| :frequency => '4', | |
| :complete => "request", | |
| :method => 'GET' | |
| ) |
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
| find . -name "* *"|while read file | |
| do | |
| echo "$file" | |
| mv "$file" "`echo "$file"| awk ' BEGIN {OFS="_"} $1=$1 '`" | |
| done | |
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 | |
| # Find common Twitter friends | |
| # Usage: ./twat.rb user1 user2 ... | |
| lists = ARGV.inject({}) do |hash, username| | |
| page = 0 | |
| while !(output = `curl -s http://twitter.com/statuses/friends/#{username}.xml?page=#{page += 1} | grep "<screen_name>"`.gsub(%r{</?screen_name>}, '').split).empty? | |
| hash[username] = ((hash[username] || []) + output).sort | |
| end | |
| hash |
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 :db do | |
| desc 'Drops and recreates the database from db/schema.rb for the current environment and loads the seeds.' | |
| task :reset => [ 'db:drop', 'db:setup' ] | |
| desc 'Create the database, load the schema, and initialize with the seed data' | |
| task :setup => [ 'db:create', 'db:schema:load', 'db:seed' ] | |
| desc 'Load the seed data from db/seeds.rb' | |
| task :seed => :environment do | |
| seed_file = File.join(Rails.root, 'db', 'seeds.rb') |
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 "cgi" | |
| require 'active_record' | |
| ActiveRecord::Base.establish_connection( | |
| :adapter => , | |
| :database => , | |
| :username => , | |
| :password => , | |
| :host => |
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
| task :bail do | |
| hostname = `hostname`.to_s.strip | |
| if hostname == 'prodsite.ca' | |
| puts "this task cannot be run from this host (#{hostname})" | |
| exit | |
| end | |
| end | |
| desc "pull data from production server" | |
| namespace :resources do |
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 'rest_client' | |
| params = { "accountType" => "HOSTED_OR_GOOGLE", "Email" => '[email protected]', "Passwd" => 'secret', "service" => "writely" } | |
| result = RestClient.post "https://www.google.com/accounts/ClientLogin", params | |
| result.to_s[/Auth=(.*)/, 1] |
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
| <link rel="stylesheet" href="/stylesheets/all.css" type="text/css" /> | |
| <link rel="stylesheet" href="/stylesheets/minimum.css" type="text/css" media="handheld, all" /> | |
| <style type="text/css" media="print, screen and (min-width: 481px)" xml:space="preserve"> | |
| @import url("/stylesheets/advanced.css"); | |
| </style> |
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
| # recent xcode | |
| # http://developer.apple.com/technologies/xcode.html | |
| # brew | |
| ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)" | |
| brew doctor | |
| # UNIX stuff | |
| brew install git | |
| brew install imagemagick |
OlderNewer