Skip to content

Instantly share code, notes, and snippets.

View adamflorin's full-sized avatar

Adam Florin adamflorin

View GitHub Profile
@adamflorin
adamflorin / tone-timing.js
Created December 19, 2017 19:37
Tone.js timing inaccuracy
import Tone from 'tone'
const bpm = 120.0
const QUARTER_NOTE_MS = 60000.0 / bpm
var lastTime
Tone.Transport.bpm.value = bpm;
// Measure time delta since last call, warn if early or late
@adamflorin
adamflorin / redcarpet-crasher.rb
Created October 18, 2013 18:08
Repeatedly raising errors in Redcarpet formatting callbacks eventually crashes Redcarpet instance.
require 'redcarpet'
# Custom handler that raises error.
#
module Redcarpet
module Render
class Crasher < HTML
def paragraph(text)
raise "Error!"
end
@adamflorin
adamflorin / Cakefile
Created July 16, 2013 05:11
De/serialize JS objects to and from Dicts, respecting arrays, nulls, etc.
{exec} = require 'child_process'
task "build", "Compile all CoffeeScript to JavaScript", ->
exec 'coffee --bare --compile --join persistence-test.js ' +
("#{file}.coffee" for file in ["utilities", "persistence", "test"]).join(" "),
(err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
@adamflorin
adamflorin / class.coffee
Last active December 16, 2015 00:58 — forked from lancejpollard/class.coffee
Use ? shorthand
moduleKeywords = ['included', 'extended', 'prototype']
class Class
# Rename an instance method
#
# ``` coffeescript
# class User
# @alias "methods", "instance_methods"
#
# ```