Skip to content

Instantly share code, notes, and snippets.

def get_upload_url(meta)
xml_entry = build_xml_entry(meta)
headers = {
'Authorization' => meta[:client_login] ? %Q(GoogleLogin auth="#{meta[:client_login]}") : %Q(AuthSub token="#{meta[:auth_sub]}"),
'X-GData-Client' => YT_CONFIG['auth_sub']['client_key'],
'X-GData-Key' => "key=#{YT_CONFIG['auth_sub']['developer_key']}",
'Content-Length' => xml_entry.length.to_s,
'Content-Type' => "application/atom+xml; charset=UTF-8"
}
response = connection.post('/action/GetUploadToken', xml_entry, headers)
$('#search-submit').click(function(event){
event.preventDefault();
$.ajax({
type: 'GET',
url: '/companies/autocomplete.js',
data: 'q='+$('input#search').val(),
dataType: 'json',
success: function(msg){
for(var i=0; i < msg.length; i++) {
$('#company_suggestions').append('<li><input type="checkbox" name="dispute[company_ids][]" value="'+msg[i].company.id+'" id="dispute_company_'+msg[i].company.id+'" /> <label for="dispute_company_'+msg[i].company.id+'"><strong>'+msg[i].company.name+'</strong>: '+msg[i].company.description+'</label></li>')
@bryckbost
bryckbost / gist:138142
Created June 30, 2009 12:58
Slicehost and Sprinkles
h1. Setting up a new Slice with Sprinkle!
"Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails or Merb stack on a brand new slice directly after its been created"
http://github.com/crafterm/sprinkle/tree/master
# Passenger-stack: http://github.com/benschwarz/passenger-stack/tree/master
# Configure Apache virtual host
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/drb.rb:585:in `load': Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceResponse does not refer class/module (TypeError)
require 'drb'
Adhearsion = DRbObject.new_with_uri "druby://192.168.0.58:9050"
options = { :channel => 'SIP/flowroute/16163186739',
:exten => '16164055286',
:priority => '1',
:context => 'outgoing' }
Adhearsion.originate options
require 'rubygems'
require 'wirble'
require 'pp'
Wirble.init
script_console_running = ENV.include?('RAILS_ENV') && IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
rails_running = ENV.include?('RAILS_ENV') && !(IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
irb_standalone_running = !script_console_running && !rails_running
if script_console_running
export PS1='\[\033[0;35m\]\u:\[\033[0;33m\] \W\[\033[00m\]: '
* install Snow Leopard
* install latest xCode
* download, install MySQL X86_64
* install mysql gem
** sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
* update gems
* fix other gems that build native extensions(sphinx?, rmagick, nokogiri, etc…)
require "rubygems"
require 'scrobbler'
require 'tinder'
user = Scrobbler::User.new('nsain')
output = "#{user.username}'s Top 5 Weekly Artists\n" + ("-" * (user.username.length + 30)) + "\n"
user.weekly_artist_chart[0..4].each {|t| output += "#{t.name} (#{t.playcount})\n" }
campfire = Tinder::Campfire.new('subdomain')
@bryckbost
bryckbost / canvas_test.html
Created June 8, 2010 18:20
Simple canvas example to draw a rectangle with a pointed end
<!DOCTYPE>
<html>
<head>
<script type="application/javascript">
// https://developer.mozilla.org/en/Canvas_tutorial
function draw() {
var canvas = document.getElementById('canvas');
if (canvas) {