Skip to content

Instantly share code, notes, and snippets.

var express = require('express'),
request = require('request'),
BufferList = require('bufferlist').BufferList,
sys = require('sys');
var app = express.createServer(
express.logger(),
express.bodyDecoder()
);
/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))/img
var css64Encode = function (string) {
return $.base64Encode(string).
replace(/\//g, '--_').
replace(/\+/g, '-_').
replace(/\=/g, '_');
};
var css64Decode = function (string) {
return $.base64Decode(string.
replace(/--_/g, '/').
// Usage:
// var file = fopen("/tmp/firefuck.txt");
// file.writeString("Hello, sir. How are you?\n");
// file.close();
var fopen = function (path) {
try {
var file = Components.classes["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(path);
var stream = Components.classes["@mozilla.org/network/file-output-stream;1"].
" Change tabs to 2 spaces
:retab 2
" Wrap the margin at 80 chars
:set wrapmargin=80
" Show non-printable characters in Vim
:set list
" Interactive search and replace
// Javascript Arrays already have:
// Array.indexOf
// Array.lastIndexOf
// Array.every
// Array.filter
// Array.forEach
// Array.map
// Array.some
Array.prototype.remove = function (from, to) {