Skip to content

Instantly share code, notes, and snippets.

View raws's full-sized avatar
🥯
dabbling in pumpernickel

Ross Paffett raws

🥯
dabbling in pumpernickel
View GitHub Profile
require "test_helper"
module Chevalet
class ImageTest < ImageTestCase
%w(gif jpg png).each do |format|
test "validates a real #{format} image" do
image(format.to_sym) do |data|
image = Image.new(data)
assert image.send("#{format}?")
end
image = Magick::Image.read("caption:#{text}") do
self.font = params["font"]
end
module Intercept
class << self
attr_reader :interceptors
def intercept(command, method=nil, &block)
interceptor = { :command => command, :action => method || block }
(@interceptors ||= []) << interceptor
end
end
@raws
raws / gist:663581
Created November 5, 2010 02:55
EventMachine cleverness to capture stderr
module EventMachine
class StderrHandler < EventMachine::Connection
def initialize(connection)
@connection = connection
end
def receive_data(data)
@connection.receive_stderr(data)
end
end
"</td><td><font color=\"#b45fb4\"><tt>starspun</tt></font></td><td width=\"100%\"><tt>This one had SO</tt></td></tr>\n"
"</td><td><font color=\"#b45fb4\"><tt>starspun</tt></font></td><td width=\"100%\"><tt>MUCH</tt></td></tr>\n"
"</td><td><font color=\"#b45fb4\"><tt>starspun</tt></font></td><td width=\"100%\"><tt>PELVIC</tt></td></tr>\n"
"</td><td><font color=\"#b45fb4\"><tt>starspun</tt></font></td><td width=\"100%\"><tt>THRUSTING</tt></td></tr>\n"
"</td><td><font color=\"#6ccdcd\"><tt>Noxy</tt></font></td><td width=\"100%\"><tt>... Raws, are you gay?</tt></td></tr>\n"
require "rubygems"
require "sinatra"
require "json"
class Jsonify
def initialize(app)
@app = app
end
def call(env)
require "rubygems"
require "sinatra"
require "json"
after do
response.body = response.body.to_json
content_type :json
end
get "/foo" do
set realmlist us.logon.worldofwarcraft.com
set patchlist enUS.patch.battle.net:1119/patch
set realmlistbn ""
set portal us
/*
* Asserts to use in Objective-C method bodies
*/
#define NSAssert5(condition, desc, arg1, arg2, arg3, arg4, arg5) \
_NSAssertBody((condition), (desc), (arg1), (arg2), (arg3), (arg4), (arg5))
#define NSAssert4(condition, desc, arg1, arg2, arg3, arg4) \
_NSAssertBody((condition), (desc), (arg1), (arg2), (arg3), (arg4), 0)
if (condition)
{
// HUGE BLOCK OF CODE
}
else
[self setErrorMessage:WHLocalizedString(@"Unsupported realm")];
[self setStatusMessage:WHLocalizedString(@"Upload successful")];
// ...