Skip to content

Instantly share code, notes, and snippets.

View fearphage's full-sized avatar
⌨️
Cache rules everything around me.

Phred Lane fearphage

⌨️
Cache rules everything around me.
View GitHub Profile
function XHConn()
{
var xmlhttp, bComplete = false;
try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) { try { xmlhttp = new XMLHttpRequest(); }
catch (e) { xmlhttp = false; }}}
if (!xmlhttp) return null;
this.connect = function(sURL, sMethod, sVars, fnDone)
{
function Foo() {
if (this == window) {
var F = function(){ };
F.prototype = Foo.prototype;
var inst = new F();
Foo.apply(inst, arguments);
return inst;
}
else {
this.init.apply(this, arguments);
This gist aims to prove or disprove the assertion made here[1] and linked on
Ajaxian[2] that dynamic script requests, or more specifically JSONP requests,
leak memory in all modern browsers.
The specific setup is a 200ms interval that requests an uncached script pointed at
the simple php file. This file in response sends the following string:
update()
This is not technically a JSONP response, since the would-be callback is executed
without arguments. However, memory footprint results can be gauged on generic
@fearphage
fearphage / diff_for_gist.user.js
Created November 6, 2009 10:06 — forked from os0x/diff_for_gist.user.js
Diff for gist.github for Opera
// ==UserScript==
// @name Diff for gists for Opera
// @include http://gist.github.com/*
// @include https://gist.github.com/*
// @ujs:modified 2010-09-10
// @ujs:download http://gist.github.com/raw/227881/53ad5dff46b825ea3facd77532b57da2ab445425/diff_for_gist.user.js
// ==/UserScript==
(function(window, $, rev) {
if (!$ || ((rev = $('#revisions li')).length < 2)) return;
APPNAME = org.avdi.myapp
VERSION = 1.0.0
DEVICE = tcp
PACKAGEFILE = $(APPNAME)_$(VERSION)_all.ipk
VMNAME = "Palm Emulator (1.2.0.33)"
EMUPORT = 5522
M4 = m4
PACKAGE = palm-package
INSTALL = palm-install
INSTALLFLAGS = -d $(DEVICE)
###############################################################################
## Mobify Apache Redirect Plugin v1.1 ##
## http://mobify.me ##
## ##
## Installation: ##
## ##
## First: for this to work, you need to configure a mobile site for ##
## yourself using Mobify. Then follow the CNAME setup instructions for ##
## pointing m.yoursite.com to your Mobify account: ##
## http://support.mobify.me/faqs/general/dns ##
const Name = 'gatherer',
Gatherer = 'http://gatherer.wizards.com/',
Base = '<style>'+ <![CDATA[
.error {font-style:oblique; line-height:1.8}
.logo {display:inline-block; max-width:100%}
.logo > img {border:none; max-width:100%}
.loading + .logo {opacity:0.4}
.error + .logo {opacity:0.7}
]]> +'</style>'+
<div class={Name}><div id={Name}> </div
@fearphage
fearphage / gist_logs.user.js
Created November 8, 2009 02:47 — forked from satyr/gist_logs.user.js
Shows commit logs on gist for Opera
// ==UserScript==
// @name gist logs
// @namespace http://d.hatena.ne.jp/murky-satyr
// @description Shows commit logs on Gist in Opera
// @include http://gist.github.com/*
// @include https://gist.github.com/*
// ==/UserScript==
(function($, reHref, reLines) {
$ && $('.id').each(function(i, me) {
/* jquery.tinydb - jQuery interface to TinyDB (http://tinydb.org/)
* Copyright (c) 2008 Chris Moyer (chris@inarow.net)
*
* usage:
* jQuery.tinydb.read(tinydb_id, callback);
* callback is called with the data from TinyDB
*
* jQuery.tinydb.write({key: val, key2: val2}, callback);
* write data, callback is called with tinydb_id string
*
Database = Class.create({
initialize: function(tableName) {
this.tableName = tableName;
this.db = openDatabase("Database Name", "1.0", "Display Name", 10000);
},
handleFirstTimers: function(firstTimeCallback, everyOtherTimeCallback) {
this.db.transaction(function(tx) {
tx.executeSql("CREATE TABLE IF NOT EXISTS " + this.tableName + " (flag REAL)",[], function(tx, result) {
tx.executeSql("SELECT flag FROM " + this.tableName, [], function(tx, result) {