Skip to content

Instantly share code, notes, and snippets.

View adamwiggins's full-sized avatar

Adam Wiggins adamwiggins

View GitHub Profile
class Accelerate( IntervalAction ):
def init(self, other, rate = 2):
self.other = other
self.rate = rate
self.duration = other.duration
def start(self):
self.other.target = self.target
self.other.start()
require 'bacon'
require 'mocha/standalone'
require 'mocha/object'
class Bacon::Context
include Mocha::Standalone
def initialize(name, &block)
@name = name
@before, @after = [
require 'sinatra'
before do
@refer = request.env['HTTP_REFERER']
m = (request.env['HTTP_REFERER'] || '').match(%r{https?://([^\/]+)/})
@refer_host = m ? m[1] : ''
end
get '/' do
@refer_host
if(CGImageGetColorSpace(image)) {
if(hasAlpha || bpp >= 8)
pixelFormat = defaultAlphaPixelFormat;
else
pixelFormat = kTexture2DPixelFormat_RGB565;
} else //NOTE: No colorspace means a mask image
pixelFormat = kTexture2DPixelFormat_A8;
/** Possible Pixel Formats for the EAGLView */
typedef enum {
/** RGB565 pixel format. No alpha. 16-bit */
kPixelFormatRGB565,
/** RGBA format. 32-bit (default) */
kPixelFormatRGBA8888,
kRGB565 = kPixelFormatRGB565,
kRGBA8 = kPixelFormatRGBA8888,
} tPixelFormat;
@interface PlaySound : InstantAction
{
NSString *file;
}
+(void) play:(NSString *)file;
+(id) action:(NSString *)file;
-(id) init:(NSString *)_file;
NoMethodError: undefined method `arguments' for nil:NilClass
vendor/amqp/lib/mq.rb:170:in `process_frame'
vendor/amqp/lib/amqp/client.rb:9:in `process_frame'
vendor/amqp/lib/amqp/client.rb:117:in `receive_data'
vendor/amqp/lib/mq.rb:170:in `run_machine'
#!/usr/bin/env ruby
require 'bunny'
require 'uri'
queue_name = ARGV.shift or abort "usage: bleed_queue <queue>"
def options
uri = URI.parse(ENV["AMQP_URL"])
{
config = URI.parse(ENV['MONGO_URL'] || 'mongodb://localhost:27017/thedb')
MongoMapper.connection = Mongo::Connection.new(config.host, config.port)
MongoMapper.database = config.path.gsub(/^\//, '')
MongoMapper.database.authenticate(config.user, config.password) if config.user
require 'restclient'
require 'json'
hash = JSON.parse RestClient.get('http://json-test.heroku.com/', :accept => :json)
if hash['hello'] != 'world'
puts "Failed"
exit 1
end