Skip to content

Instantly share code, notes, and snippets.

View allenluce-zz's full-sized avatar

Allen Luce allenluce-zz

  • Substantial
  • Seattle
View GitHub Profile
def timeIt(comment, &code)
retValue = nil
time = Benchmark.realtime do
retValue = code.call
end
puts "#{comment}: %.2fms" % (time*1000)
retValue
end
beforeEach ->
@broadcasterMethods = jasmine.createSpy()
@messageBroadcaster =
strokeBegin: @broadcasterMethods
strokeContinue: @broadcasterMethods
strokeEnd: @broadcasterMethods
....
it "should return early", ->
@allenluce-zz
allenluce-zz / gist:2705488
Created May 15, 2012 22:03
Pre-clipped and Canvas-clipped stroke performance testing
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
var WIDTH = 500;
var HEIGHT = 500;
function drawoutline(id) {
var el = $(id);
var ctx = el[0].getContext('2d');