Skip to content

Instantly share code, notes, and snippets.

View cheald's full-sized avatar

Chris Heald cheald

View GitHub Profile
import android.app.Activity
import android.content.Context
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.MotionEvent
import android.graphics.Canvas
import android.graphics.Paint
class Foo
@start = Time.now.to_i
def self.start
@start
end
def make_another_class
Class.new do
@start = Time.now.to_i
def self.start
require 'mongo'
require 'progress_bar'
db = Mongo::Connection.new["colors"]
identify = "identify %s"
convert = "convert %s -format %%c -colors 5 -colorspace LAB histogram:info:-"
def run(cmd, *args)
str = cmd % args
`#{str}`
end
% ab -n 10000 -c16 http://mybb.local/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking mybb.local (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
/* Reset.scss
* Props to Eric Meyer (meyerweb.com) for his CSS reset file.
We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e., dfn, samp, etc).
* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
// ERIC MEYER RESET
// --------------------------------------------------
html, body { margin: 0; padding: 0; }
# Fetch and setup the canvas. $canvas is a jQuery object wrapping a <canvas> tag.
canvas = $canvas[0]
w = $canvas.data('width') || $canvas.width()
h = $canvas.data('height') || $canvas.height()
canvas.width = w
canvas.height = h
c = canvas.getContext("2d")
c.lineCap = 'round'
c.lineWidth = 2.5
%%{
machine rfc2822_header;
action mark {
@pos = p
}
action domain {
# We have to match 'foo . bar' per the tests and transform it into 'foo.bar'
@parts[:host] = data[@pos..p-1].delete(" ")
# Renders the given content or block in a CDATA section if necessary. If CDATA is not necessary, the raw data is returend.
# @param data [String] The data to render. Nil if passing a block.
# @yield Template fragment to encode as CDATA if necessary.
def cdata(data = nil)
data = data.dup if data.present? and data.frozen?
if data
data.strip!
data.gsub!(/\]\]>/, "]]&gt;")
if match = data.match(/([<>&]|[^\x20-\x7f])/)
data = "\n%s" % data if data.match(/\n/)
module AuthenticationHelpers
def authenticated_as(roles, options=nil)
options = instance_eval(&options) if options.is_a? Proc
Array(roles).each do |role|
context "when logged in as a #{role}" do
before(:all) { @user = FactoryGirl.create role, *Array(options) }
after(:all) { DatabaseCleaner.clean }
before(:each) { sign_in @user }
% rspec spec.rb --format doc
Foo
when logged in as a user
should == "TEST VALUE"
Finished in 0.00047 seconds
1 example, 0 failures