Skip to content

Instantly share code, notes, and snippets.

Avatar

James Tucker raggi

View GitHub Profile
@raggi
raggi / description.md
Last active Aug 29, 2015
US Airways lost bags Jan 4, 2015
View description.md

If you're currently waiting for your bags, because you flew sometime since the 4th of January 2015, and you came in via SFO: go to the airport they're there!

Customer service will tell you they're "with the delivery company" (they've been telling me this for three days). They'll tell you that "once it's with the delivery company, it goes to their warehouse" - there is no warehouse, at SFO it's ONE GUY as far as I can tell. They won't give you his name (it's Eddie - dial 650 652 5600 for an amusing full mailbox and "professional response" (it's been this way for over a year AFAICT - search around for the company name)). The company is called "Sterling Baggage" (not "whereismysuitcase.com", which is run by Bags Inc. who are similarly knowledge-less at all public phone numbers). If you call the SFO office, the lady there will tell you "it's on it's way" (which is also a lie).

I took the risk, given I'd been told by everyone that it was "on it's way, today" for the last three days, of driving up there. I'm

@raggi
raggi / bin-compile
Created May 12, 2015
A "pure" Heroku buildpack for Golang, uses GOPATH, no Godep. Make in a repo with files under bin/detect and bin/compile
View bin-compile
#!/bin/bash
BUILD_DIR=$1
CACHE_DIR=$2
ENV_DIR=$3
GOBALL=go1.4.1.linux-amd64.tar.gz
mkdir -p $CACHE_DIR
export PATH=$PATH:$CACHE_DIR/go/bin
View config.ru
#!/usr/bin/env thin -e production -R config.ru -V start
# config.ru
# N.B. Rack::Lint doesn't yet support the api, use production mode rack.
require 'eventmachine'
class AsyncApp
class DeferrableBody
include EventMachine::Deferrable
View gist:61367
class FiberedMutex
#
# Creates a new FiberedMutex
#
def initialize
@waiting = []
@locked = false
end
#
@raggi
raggi / gist:79926
Created Mar 16, 2009
Example implementation for Sinatra::Async, to be used with async thin
View gist:79926
# async_sinatra_example.ru
require 'sinatra'
# Normally Sinatra::Base expects that the completion of a request is
# determined by the block exiting, and returning a value for the body.
#
# In an async environment, we want to tell the webserver that we're not going
# to provide a response now, but some time in the future.
#
# The a* methods provide a method for doing this, by informing the server of
@raggi
raggi / gist:80247
Created Mar 17, 2009
eventmachine postgres to sequel async shim
View gist:80247
# I stole this code from em-mysql (tmm1 <3)
module Sequel
class Database
attr_accessor :_async
end
class Dataset
def async_insert *args, &cb
db._async.insert insert_sql(*args), &cb
nil
@raggi
raggi / sinatra_metal.rb
Created Mar 18, 2009
sinatra as rails metal example - mostly unnecessary
View sinatra_metal.rb
require 'sinatra/metal'
class SinatraMetal < Sinatra::Base
include Sinatra::Metal
get '/sinatra' do
'hello sinatra!'
end
end
@raggi
raggi / gdb_stack_size.rb
Created Apr 30, 2009
show the effects of stack size on ruby's performance
View gdb_stack_size.rb
#!/usr/bin/env ruby
require "benchmark"
bit64 = 1.size == 8
open('gdb-script', 'w') do |f|
f.puts <<-EOS
p ((unsigned int)rb_gc_stack_start - (unsigned int)$#{bit64 ? 'r' : 'e'}sp)
detach
@raggi
raggi / cranking.rb
Created May 29, 2009
EventMachine.crank
View cranking.rb
require 'thread'
module EventMachine
module Test
module Utils
module Cranking
# Stolen from MenTaLguYs Omnibus
class Waiter
def initialize
View benchmark.rb
require "benchmark"
class Hash
# Performs the opposite of <tt>merge</tt>, with the keys and values from the first hash taking precedence over the second.
def reverse_merge(other_hash)
other_hash.merge(self)
end
# Performs the opposite of <tt>merge</tt>, with the keys and values from the first hash taking precedence over the second.
# Modifies the receiver in place.
def reverse_merge!(other_hash)