Skip to content

Instantly share code, notes, and snippets.

// Javascript Arrays already have:
// Array.indexOf
// Array.lastIndexOf
// Array.every
// Array.filter
// Array.forEach
// Array.map
// Array.some
Array.prototype.remove = function (from, to) {
" 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
// 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"].
// our particular spider
var spider = new Spider();
spider.grabber = function ($) {
var urls = [];
$('.post-footer > a:nth-child(2)').each(function (i, node) {
urls.push(node.href);
});
var next_page_button = $('.next_page');
var on_last_page = next_page_button.hasClass('disabled');
var data = {
// ==UserScript==
// @name Eensy Weensy
// @namespace example.com
// @include http://borderstylo.com/posts*
// ==/UserScript==
var css64Encode = function (string) {
return $.base64Encode(string).
replace(/\//g, '--_').
replace(/\+/g, '-_').
replace(/\=/g, '_');
};
var css64Decode = function (string) {
return $.base64Decode(string.
replace(/--_/g, '/').
/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))/img
# load a file foo.pez into the repl
-> "foo.pez" load
0
# concatenate two strings
-> "hello" "world" s+
Stack: 32395168
-> puts
helloworld
var express = require('express'),
request = require('request'),
BufferList = require('bufferlist').BufferList,
sys = require('sys');
var app = express.createServer(
express.logger(),
express.bodyDecoder()
);
@thebigbad
thebigbad / tidypubscraper.pl
Created November 30, 2010 21:43
generate a list of all tidypub urls in use. would take an estimated 12 years to complete a run on a single machine.
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use Math::BaseArith;
my $browser = LWP::UserAgent->new;
sub get {