A few tips for shaving some bytes off your JS demos. I will probably add more to this list in the future.
26B:
new Option(html).innerHTML
function fromJS(anObject) | |
{ | |
var objectsToReferences = new Map(); | |
return fromJS(anObject); | |
function fromJS(anObject) | |
{ | |
if (objectsToReferences.has(anObject)) | |
return objectsToReferences.get(anObject); |
C++ source: | |
void call_by_reference(int& x) | |
{ | |
x = 20; | |
} | |
void call_by_pointer(int* x) | |
{ | |
*x = 20; |
From e22317131b97d0faa5510b528ef515ccbbbd3e8e Mon Sep 17 00:00:00 2001 | |
From: Jacob Rothstein <github@jacobrothstein.com> | |
Date: Tue, 13 Jul 2010 13:24:34 -0700 | |
Subject: [PATCH] fix showdown to work in chrome (don't use RegExp.leftContext and RegExp.rightContext globals) | |
--- | |
scripts/showdown.js | 10 ++++------ | |
1 files changed, 4 insertions(+), 6 deletions(-) | |
diff --git a/scripts/showdown.js b/scripts/showdown.js |
// cache from global scope | |
var _parseInt = this.parseInt; | |
_speedTest( | |
[ | |
function(n) | |
{ | |
var r, g, b, s = '#aabbcc'; | |
var i = n; while(i--) | |
{ |
/** | |
* Console object for BESEN | |
* @author Dmitry A. Soshnikov <dmitry.soshnikov@gmail.com> | |
*/ | |
(function initConsole(global) { | |
// helpers | |
var getClass = Object.prototype.toString; | |
var timeMap = {}; |
var express = require('express'), | |
app = express.createServer(); | |
app.enable('jsonp callback'); | |
app.get('/jsonp', function(req, res) { | |
res.send({ foo: 'bar' }); | |
}); |
#!/usr/bin/env node | |
var http = require('http') | |
, webapp = require('webapp'); | |
http.createServer(webapp.bind([])).listen(8000); | |
// ^^^^^^^^^^^^^^^ | |
// | (x) | |
// ROFLSCALE DEQUE ---/ |
Document.prototype.createStyleSheet = function (rules) { | |
var stylesheet = this.documentElement.appendChild( | |
this.createElementNS("http://www.w3.org/1999/xhtml", "style") | |
).sheet; | |
stylesheet.insertRule("@media all{" + rules + "}", 0); | |
return stylesheet; | |
}; |
$gutter: 10px; | |
$grid-unit: 60px; | |
%clearfix { | |
*zoom: 1; | |
&:after { | |
content: "\0020"; | |
display: block; | |
height: 0; | |
clear: both; |