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
| 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() |
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 'bacon' | |
| require 'mocha/standalone' | |
| require 'mocha/object' | |
| class Bacon::Context | |
| include Mocha::Standalone | |
| def initialize(name, &block) | |
| @name = name | |
| @before, @after = [ |
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 '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 |
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
| if(CGImageGetColorSpace(image)) { | |
| if(hasAlpha || bpp >= 8) | |
| pixelFormat = defaultAlphaPixelFormat; | |
| else | |
| pixelFormat = kTexture2DPixelFormat_RGB565; | |
| } else //NOTE: No colorspace means a mask image | |
| pixelFormat = kTexture2DPixelFormat_A8; |
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
| /** 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; |
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
| @interface PlaySound : InstantAction | |
| { | |
| NSString *file; | |
| } | |
| +(void) play:(NSString *)file; | |
| +(id) action:(NSString *)file; | |
| -(id) init:(NSString *)_file; |
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
| 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' |
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 'bunny' | |
| require 'uri' | |
| queue_name = ARGV.shift or abort "usage: bleed_queue <queue>" | |
| def options | |
| uri = URI.parse(ENV["AMQP_URL"]) | |
| { |
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
| 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 |
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 'restclient' | |
| require 'json' | |
| hash = JSON.parse RestClient.get('http://json-test.heroku.com/', :accept => :json) | |
| if hash['hello'] != 'world' | |
| puts "Failed" | |
| exit 1 | |
| end |