Skip to content

Instantly share code, notes, and snippets.

var _missing= function(data){ return React.DOM.pre(null, "Route not found: "+ data.route) },
_router= null,
_started= false,
_nextId= 1;
function handleRouteChange(container, component) {
var routeParams= Array.prototype.slice.call( arguments, 1 )
React.renderComponent(
component({ routeParams:routeParams }, null),
container
@itrelease
itrelease / console.js
Created August 21, 2012 10:34
Console object
(function(consoleObject) {
var funcNames = [
'assert', 'count', 'debug', 'dir',
'dirxml', 'error', 'exception', 'group',
'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'time',
'timeEnd', 'trace', 'warn'
], i, funcName;
for (i=0; i<funcNames.length; i+= 1) {
@itrelease
itrelease / calc-scrollbar-width.js
Created October 25, 2011 14:10
Calculate scrollbar width
/*
.scrollbar-measure {
width: 100px;
height: 100px;
overflow: scroll;
position: absolute;
top: -9999px;
}
*/
// Create the measurement node
/**
* Delegation based mixins for JavaScript.
*
* Non-specific extensions are used:
* __proto__
* __noSuchMethod__
*
* Tested in SpiderMonkey.
*
* Opened issues:
var _restoreSymbol = (function($G)
{
var iframe = document.createElement('iframe');
(document.body || document.documentElement).appendChild(iframe);
iframe.style.display = 'none';
var win = iframe.contentWindow, doc = win.document;
doc.open();
/*
* classList.js
*
* Implements a cross-browser element.classList getter.
*
*/
"use strict";
if (typeof Element !== "undefined") {
if (!window.localStorage || !window.sessionStorage) (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
/**
* Aliases and additional "sugar"
* 2010-04-15
* @author Dmitry A. Soshnikov
*/
(function () {
["defineProperty", "defineProperties", "keys", "getOwnPropertyNames",
"getOwnPropertyDescriptor", "getPrototypeOf", "seal", "freeze",
"preventExtensions", "isFrozen", "isSealed", "isExtensible"]
/* by Dmitry A. Soshnikov */
var object = (function () {
// private
var _x = 10;
// also private
function _privateFunc() {
return _x;
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};