Skip to content

Instantly share code, notes, and snippets.

Avatar

David Rice davidjrice

  • Northern Ireland
View GitHub Profile
View lighthouse_bulk_milestone_reassignment.rb
require 'rubygems'
require 'active_support'
require 'vendor/plugins/lighthouse-api/lib/lighthouse'
usage = "USAGE: ruby lighthouse_reassign api-key account-subdomain project-id milestone_to_move_from milestone_to_move_to"
token = $ARGV[0]
subdomain = $ARGV[1]
project_id = $ARGV[2].to_i
milestone_to_move_from = $ARGV[3].to_i
milestone_to_move_to = $ARGV[4].to_i
View frame.rb
require 'rubygems'
require 'RMagick'
size = [85,85]
dst = Magick::Image.read("frame2.svg") {
self.background_color = 'white'
}.first
src = Magick::Image.read('lime.jpg').first
View gist:57847
I had issues with the instructions on weblog.rubyonrails.org.
gem install rails --source http://gems.rubyonrails.org
What did work was.
sudo gem install rack
sudo gem install rails --source http://gems.rubyonrails.org --version 2.3.0
View gist:83671
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
SQL (0.3ms) SET NAMES 'utf8'
SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
Processing TestController#index (for 127.0.0.1 at 2009-03-23 17:20:16) [GET]
Rendering test/index
View pokercopilot-errors.txt
2009-08-01 13:37:06 INFO: Launcher.Launcher
2009-08-01 13:37:06 INFO: Launcher.createAndShowGUI
2009-08-01 13:37:07 INFO: Session start time = 2009-08-01T13:37:07.249+01:00
2009-08-01 13:37:07 INFO: Today start time = 2009-08-01T00:00:00.000+01:00
2009-08-01 13:37:08 INFO: MenuBarFactory.createMenuBar
2009-08-01 13:37:08 INFO: ToolbarFactory.createToolBar
2009-08-01 13:37:08 INFO: MenuBarFactory.createMenuBar
2009-08-01 13:37:08 INFO: Launcher.registerForMacOSXEvents
2009-08-01 13:37:08 INFO: MenuBarFactory.createMenuBar
2009-08-01 13:37:09 INFO: MuckedCardsWindow.MuckedCardsWindow
View mymobileapi-test.rb
require 'net/http'
HOST = "http://www.mymobileapi.com"
PORT = 80
def log!(message)
STDERR.puts "#{Time.now.to_s} #{message}"
end
def call_remote(method, params)
View gist:297851
error: function(XMLHttpRequest, textStatus, errorThrown) {
var response = XMLHttpRequest.responseText;
var start = response.indexOf('(');
var finish = response.indexOf(')');
var json = JSON.parse( response.substring(start+1,finish) );
$status.text(json['error']);
}
View oauth.js
"Authorization": {
"oauth_consumer_key": "xxx",
"oauth_nonce": new Date().getTime(),
"oauth_signature_method": "HMAC-SHA1",
"oauth_timestamp": new Date().getTime(),
"oauth_version": "1.0",
}
// Need to get into the format.
View oauth-node-header.txt
POST /oauth/request_token HTTP/1.1
Host: twitter.com
Authorization: OAuth realm="",
oauth_consumer_key="cV3cvjwaUW6GKoz55nkc8A",
oauth_nonce="9844f81e1408f6ecb932137d33bed7cfdcf518a3",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1265944827491",
oauth_version="1.0",
oauth_signature="Wew/m+9v023JD7pv59QZDGixTJc"
Connection: close
View js-worker.js
var items = []
// items.push({data: "..."})
// called somewhere in the code
function worker_loop(){
while(true == true){
if(items.length>0){
do_work(items.shift())
} else {