This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RegExp.prototype.findAll = function(str) { | |
var match = null, results = []; | |
while ((match = this.exec(str)) !== null) { | |
switch (match.length) { | |
case 1: | |
results[results.length] = match[0]; | |
break; | |
case 2: | |
results[results.length] = match[1]; | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Which of these would you rather play hunt-the-missing-comma with? | |
$template({name: 'article_list', extends: 'article_base'}, | |
$block('content', | |
DIV({'class': 'articles'}, | |
$for('article in articles', | |
DIV({id: 'article{{ article.id }}'}, | |
H2('{{ article.title }}'), | |
DIV({'class': 'body'}, | |
$html('{{ article.body }}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Variable(name) { | |
this.name = name; | |
} | |
function VariableNotFoundError(name, context) { | |
this.name = name; | |
this.context = context; | |
} | |
function Context() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html xmlns:o="urn:schemas-microsoft-com:office:office" | |
xmlns:x="urn:schemas-microsoft-com:office:excel" | |
xmlns="http://www.w3.org/TR/REC-html40"> | |
<head> | |
<meta http-equiv="expires" content="Mon, 06 Jan 1999 00:00:01 GMT"> | |
<meta http-equiv=Content-Type content="text/html; charset=UTF-8"> | |
<!--[if gte mso 9]><xml> | |
<x:ExcelWorkbook> | |
<x:ExcelWorksheets> | |
<x:ExcelWorksheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>tableToExcel Demo</title> | |
<script src="tableToExcel.js"></script> | |
</head> | |
<body> | |
<h1>tableToExcel Demo</h1> | |
<p>Exporting the W3C Example Table</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loader = (function() { | |
var index = 0 | |
, timeout = null | |
, symbols = ['└', '├', '┌', '┬', '┐', '┤', '┘', '┴']; | |
function show () { | |
console.log(symbols[index]); | |
index = (index + 1) % symbols.length; | |
timeout = setTimeout(show, 200); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Please... just don't | |
var S = (function() { | |
var instance = null | |
function S() { | |
if (instance !== null) return instance | |
if (!(this instanceof S)) return new S() | |
instance = this | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Call apply() in the context of document.getElementById with the arguments: document, ['header'] | |
Function.prototype.apply.call(document.getElementById, document, ['header']) | |
// Apply apply() in the context of document.getElementById with the arguments: document, ['header'] | |
Function.prototype.apply.apply(document.getElementById, [document, ['header'])) | |
// Call call() in the context of document.getElementById with the arguments: document, header | |
Function.prototype.call.call(document.getElementById, document, 'header') | |
// Apply call() in the context of document.getElementById with the arguments: document, header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(__global__, server) { | |
// =============================================================== Utilities === | |
var DOMBuilder = (server ? require('DOMBuilder') : __global__.DOMBuilder) | |
, forms = (server ? require('newforms') : __global__.forms) | |
var slice = Array.prototype.slice | |
, toString = Object.prototype.toString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone git://github.com/insin/sacrum.git | |
cd sacrum | |
npm install -d | |
node server.js | |
Go to http://127.0.0.1:8000/admin/ | |
Click around (notice JavaScript logging in your browser's console) | |
Disable JavaScript |