Skip to content

Instantly share code, notes, and snippets.

@tamzinblake
tamzinblake / table.html
Created June 30, 2011 16:30
a 2-column table
<table>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
<tr><td>cell content 1</td><td>cell content 2</td></tr>
@tamzinblake
tamzinblake / quantum_weirdness.el
Created June 16, 2011 16:46
perl quantum weirdness explained
;;;This gist refers to the problem referenced at http://www.perlmonks.org/?node_id=369247
;;;written in lispy format for clarity; the following is not necessarily valid lisp
;;;m is a variable currently equal to 20
;;;expression to be evaluated: (++m + m++)
;;;pretend pre-increment and post-increment exist in lisp - then, this is the expression:
(+ (++m) (m++)) ; m = 20
;;; `preincrement' increments the variable and returns the variable
(+ m (m++)) ; m = 21
;;; the following line is the magic - replace `postincrement' with `increment, then return original value'
@tamzinblake
tamzinblake / comma.js
Created June 13, 2011 17:54
alternate comma-first style
//an alternate comma-first style soon to be supported by my js-mode
//The assumption is that you will consistently not put the first item in the
//list on the same line as the brace, and then want the commas / operators
//2 spaces back from there.
//normal cases:
var test = {
prop1: "value1"
@tamzinblake
tamzinblake / errors.js
Created June 7, 2011 20:53
How errors pop out in my js-mode
// Showing how errors pop out in my js-mode standard indenting:
// (https://github.com/thomblake/js-mode)
// (courtesy of https://gist.github.com/357981 for the excellent examples)
// error in standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog"
e = "elf",
@tamzinblake
tamzinblake / js2-mode-npm.md
Created June 1, 2011 20:54
Improved js2-mode for npm style
@tamzinblake
tamzinblake / regex_end_of_string.md
Created May 27, 2011 15:37
Javascript regex grammar quirk

This gist regards some confusion resulting from this StackOverflow question.

Refer to sections 15.5.4.10 and 15.5.4.11 of the spec - page 145ish.

Before any passes, the cursor is at the start of the string:

, " , f , o , o ,   , b , a , r , " ,
^

lastIndex = 0
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8080, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8080/');