Skip to content

Instantly share code, notes, and snippets.

View c-spencer's full-sized avatar

Chris Spencer c-spencer

View GitHub Profile
// Source Table
{
1: 11,
2: 13,
3: 99,
4: 5,
5: 7,
10: 6,
15: 16,
67: 123,
**** DEOPT: JSMatrix._rotate at bailout #12, address 0x0, frame size 24
[deoptimizing: begin 0x222a3c2bad1 JSMatrix._rotate @12]
translating JSMatrix._rotate => node=64, height=16
0x7fff5fbfee28: [top + 56] <- 0x222a3c49311 ; rax 0x222a3c49311 <a JSMatrix>
0x7fff5fbfee20: [top + 48] <- 0x79eadf046a1 ; [esp + 56] 0x79eadf046a1 <Number: 0.05483113556160755>
0x7fff5fbfee18: [top + 40] <- 0x3476cf386e2a ; caller's pc
0x7fff5fbfee10: [top + 32] <- 0x7fff5fbfee40 ; caller's fp
0x7fff5fbfee08: [top + 24] <- 0x222a3c492d9; context
0x7fff5fbfee00: [top + 16] <- 0x222a3c2bad1; function
0x7fff5fbfedf8: [top + 8] <- 5.480367e-02 ; xmm2
@c-spencer
c-spencer / JSMatrix.coffee
Created May 1, 2012 08:58
JS Implementation of SVGMatrix
# JSMatrix is API Compatible with SVGMatrix
PI_DEG = Math.PI/180
class JSMatrix
constructor: (@a, @b, @c, @d, @e, @f) ->
# Multiplication of direct parameters
_mult: (a, b, c, d, e, f) ->
new JSMatrix(
window.undo_tracking_labels = {}
class Sysdea.Undoer
constructor: (@label) ->
if @label? and !undo_tracking_labels[@label]
undo_tracking_labels[@label] = 0
@actions = []
push: (action) ->
if @label and @actions.length == 0
undo_tracking_labels[@label]++
@actions.push action
@c-spencer
c-spencer / request.coffee
Created March 9, 2012 19:30
jQuery ajax wrapper
request =
base: (type, params, callback) ->
$.ajax _.extend({
dataType: 'json'
type: type
success: (data) -> callback null, data
error: (data) -> callback data or JSON.stringify(arguments)
}, params)
get: (params, callback) -> @base 'GET', params, callback
post: (params, callback) -> @base 'POST', params, callback
@c-spencer
c-spencer / Cake.coffee
Created March 1, 2012 14:47
watch script for cake compile with selected files
fs = require 'fs'
coffee = require 'coffee-script'
uglify = require 'uglify-js'
option '-w', '--watch', 'watch files for changes'
task 'build:js', 'Build the javascript files', (options) ->
compileCoffeeFiles = (files, callback) ->
container = {}
@c-spencer
c-spencer / yield.html
Created December 7, 2011 01:27
Using yield/generators to flatten async callbacks.
<!DOCTYPE html>
<html>
<head>
<title>Yield is Fun</title>
</head>
<script type="application/javascript;version=1.7">
function __genLoop(generator, callback, onend) {
if (callback && typeof callback === 'function') {
try {
#coding: utf8
#################################### IMPORTS ###################################
# Sublime Libs
import sublime
import sublime_plugin
################################################################################
class ExpandselectionCommand(sublime_plugin.TextCommand):
@c-spencer
c-spencer / mathjax-webfont.html
Created May 31, 2011 09:07
Certain webfonts not rendering right size in firefox
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Crimson+Text:regular,regularitalic,bold,bolditalic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Maven+Pro:regular,500,bold,900' rel='stylesheet' type='text/css'>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
this.transformInput = function(state, editor, session, text) {
if (text == '`') {
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "") {
return {
text: '`' + selected + '`',
selection: false
}
} else {