Skip to content

Instantly share code, notes, and snippets.

@dtjohnso
dtjohnso / RemoveFastFlip.js
Created July 21, 2010 13:59
A Greasemonkey script for removing stuff I don't want from Google News
// ==UserScript==
// @name Remove from Google News
// @namespace http://duncanandmeg.org
// @description Removes the "Google Fast Flip" section
// @include http://news.google.com/
// ==/UserScript==
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js';
@dtjohnso
dtjohnso / bible-gateway-ubiquity.js
Created January 22, 2010 17:21
Bible-Gateway Ubiquity command
// converted for the Ubiquity Parser 2 by Duncan Johnson on 1/22/2010
// Response to conversation here http://bit.ly/6TO8Xg
noun_version_name = new CmdUtils.NounType("version", ["nkjv", "kjv", "niv"]);
CmdUtils.CreateCommand(
{
names: ['bible-search'],
arguments: [ {role: 'object', nountype: noun_arb_text, label: 'passage'},
{role: 'format', nountype: noun_version_name, label: 'version'}],
@dtjohnso
dtjohnso / class-links.js
Created August 28, 2009 20:18
Insert class links from remote location
CmdUtils.CreateCommand({
names: ["check parentheses"],
icon: "http://www.mozilla.com/favicon.ico",
description: "Does a simple arithmetic check to see if a selected line of code has enough parentheses.",
//help: "How to use your command.",
author: {name: "Duncan Johnson", email: "duncan@duncanandmeg.org"},
license: "GPL",
homepage: "http://andyanglea.com/blog/2009/08/if-problems/",
arguments: [{role: 'object', nountype: noun_arb_text}],
preview: function preview(pblock, args) {
@dtjohnso
dtjohnso / Parentheses count algorithm
Created August 27, 2009 14:31
Test to see if missing parentheses can be detected by a simple arithmetic count algorithm
Discussion @ http://andyanglea.com/blog/2009/08/if-problems
Error-free case:
12 1 23 4 3 2 3 4 3210 NO ERRORS
01 2 12 3 4 3 2 3 4321 NO ERRORS
if (($condition1 != $a) || ((len($condition2) == $b) && (!isset($_POST['submit'])))) {
Missing one ( case:
1* 0 12 3 2 1 2 3 210- ERROR DETECTED (ends with negative number)
1* 2 12 3 4 3 2 3 4321 ERROR DETECTED (ends with positive number)