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
###############################################################################
## 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 ([email protected])
*
* 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
*
@fearphage
fearphage / benchmarking.js
Created November 8, 2009 19:46
Very basic benchmarking function
function Benchmarker(count, args, that) {
if (Object.prototype.toString.call(args) != '[object Array]') args = [args];
function toArray() {
var name, results = this.results, array = [];
for (name in results) {
array.push(name + ': ' + results[name]);
}
return array;
}
@fearphage
fearphage / webfeeds.htm
Created November 10, 2009 13:16
Replacement view for RSS feeds in Opera
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<!--
Thanks to all contributors: Ayush, shoust
-->
<title>...</title>
<style type="text/css" media="screen,projection,tv,handheld,print,speech">
html, body {
@echo off
git init
REM safety first: just in case we're in another repository
echo..svn>.gitignore
echo..hg>>.gitignore
git add .
git commit -m "initial commit"
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) {
String.format = (function(slice) {
return function(template) {
var args = slice.call(arguments, 1), i = args.length;
while (i--) {
template = template.replace(new RegExp('\\{' + i + '\\}', 'g'), args[i]);
}
return template;
};
})(Array.prototype.slice);
/*
This is a simplified sample of an idea I had today inspired by the fab
project. Event loops currently suck... so I've built this wonky DSL for you.
I'll release a real library later that actually implements some not so easy
things.
*/