Skip to content

Instantly share code, notes, and snippets.

@pelonpelon
pelonpelon / stringify.js
Created April 28, 2015 17:14
stringify.js - view objects as strings in the console
export default ( object, jsonIndent = 2 ) =>
JSON.stringify(
object, ( key, value ) =>
value instanceof Function
? value.toString()
: value,
jsonIndent
)
.replace( /\\n/g, '\n' )
.replace( /\\r/g, '\r' )
@pelonpelon
pelonpelon / gist:d38e5fa698e1c9de7ca8
Created January 21, 2015 01:43
mithril.elements without module escape mechanism
/*
* Mithril.Elements
* Copyright (c) 2014 Phil Toms (@PhilToms3).
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
'use strict';
var m = (function app(window, mithril) {
@pelonpelon
pelonpelon / index.js
Created November 13, 2014 02:54
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")