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);
var ok1, ok2, ok3, ok4, ok5, ok6;
function A(){
ok1 = (this.constructor!=arguments.callee);
};
function B(){
ok2 = (this.constructor==arguments.callee);
};
A();
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
// Bookmaklet below
javascript:(function(d) {var mysqlID = d.cookie.match(/(?:^|\s)bugtraq:uniqueID=([^;]+)/) && RegExp.$1, elem = d.selectSingleNode('//a[starts-with(@href, "mailto:") and contains(@href, "@bugs.opera.com")]'), bugID = elem && elem.href && elem.href.match(/mailto:([^@]+)@/) && RegExp.$1 || '?', closing = '\n\nThank you,\n\nBugtraq Staff'; if (mysqlID && bugID) { d.body.appendChild(d.createElement('script')).src = 'http://opera.remcol.ath.cx/bugs/userjs.php?mysqlid=' + mysqlID + '&bugid=' + bugID; alert('Your bug has been traqed.' + closing); } else { alert('There was a problem logging your bug to the public database. Please report the failure here:\n\nhttp://my.opera.com/community/forums/topic.dml?id=217364\n\nPlease include the following details:\n\n* bug title\n' + (mysqlID ? '* internal ID: ' + mysqlId + '\n' : '') + '* external ID: ' + bugID + closing); }})(this.document);
// This is what the code looks like prettified
(function(d) {
var mysqlID = d.cookie.match(/(?:^|\s)bugtraq:
@fearphage
fearphage / bridge.js
Created August 27, 2009 16:20
Defines several additional methods for Opera missing from JS1.6
(function(slice, toString) {
// opera bug - DSK-259939
var arrayMethodsFailOnStrings = Array.prototype.filter.call('fPaAiSlS', function(c) {
return 'fail'.indexOf(c) == -1;
}).join('') != 'PASS';
function addGenerics(klass, methods) {
methods.forEach(function(name) {
if ((typeof klass.prototype[name] == 'function') && !klass[name]) {
klass[name] = (function(fn, isArray) {
@echo off
REM save this file as a .bat or .cmd file and call it from anywhere
set _installName=Opera
if NOT #%1# == ## (for /f "useback tokens=*" %%a in ('%1') do (set _installName=%%~a))
if exist "%appdata%\Opera\%_installName%\sessions\autosave.win" (
set sessionFile=%appdata%\Opera\%_installName%\sessions\autosave.win
) else (
set sessionFile=%appdata%\Opera\%_installName%\profile\sessions\autosave.win
)
Opera Preferences version 2.1
; Do not edit this file while Opera is running
; This file is stored in UTF-8 encoding
[User prefs]
Title=Opera Private mode
Opera Directory=C:\DOCUME~1\FRED~1.LAN\LOCALS~1\Temp\delete-me.1367
Opera Local Directory=C:\DOCUME~1\FRED~1.LAN\LOCALS~1\Temp\delete-me.1367
Show Default Browser Dialog=0
Enable Usage Statistics=0
(function(doc, forEach) {
var selectNodes = doc.selectNodes || function(xpath, resolver) { // for firefox
var contextNode = this.ownerDocument || this, out = [], i = 0, node
,nodes = contextNode.evaluate(xpath, contextNode, resolver || null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for ( ; node = nodes.snapshotItem(i); i++) {
out.push(node);
}
return out;
}, length = 0, time, count = 0;
function duration(secs) {
//! ==UserScript==
//! @include http://*
//! ==/UserScript==
(function(slice, toString, filter) {
// opera bug - DSK-259939
var buggy = filter.call('fPaAiSlS', function(c) { return 'fail'.indexOf(c) == -1; }).join('') != 'PASS';
function addGenerics(klass, methods) {
var fn;