Skip to content

Instantly share code, notes, and snippets.

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)
@dtjohnso
dtjohnso / class-links.js
Created August 28, 2009 20:18
Insert class links from remote location
@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 / TypographicalReplace.bas
Created September 17, 2010 12:13
Some of the characters don't show right in default view, click download or raw to get everything
Sub CurlyQs()
'
' CurlyQs Macro
' Macro first recorded Thursday, September 11, 2003 by Mark L Ward Jr
' Refactored with regex by Duncan Johnson Sept 17, 2010
'
' Makes assorted typographical corrections
FindReplace " "," " 'double spaces with a single space
FindReplace """","""" 'straight double quote with smart quote (assumes Smart Quotes are enabled in Word settings)
@dtjohnso
dtjohnso / Curated Millennium search.htm
Created March 14, 2011 21:00
Enables keyword searching with a hard-coded subject category on a III Millennium catalog.
<!-- Suggested test search strings: Daniel, puppet, David -->
<script src="http://code.jquery.com/jquery-1.5.js"></script>
<form target="blank" action="http://library.bju.edu/search/X" id="search" style="margin: 0 0 20px 0;">
<input name="search" type="hidden" id="target"/>
<input name="searchscope" value="7" type="hidden" />
<input name="SORT" value="D" type="hidden" />
<input name="userInput" id="userInput" size="30" maxlength="75" /><br/>
<input value="Search" type="submit" />
<input value="Reset" type="reset" />
</form>
[JavaScript Error: "Translate: translator called select items with no items" {file: "file:///H:/zotero%20profile/translators/Google%20Books.js" line: 0}]
[JavaScript Error: "Translate: translator called select items with no items" {file: "file:///H:/zotero%20profile/translators/Google%20Books.js" line: 0}]
@dtjohnso
dtjohnso / google-books.htm
Created April 26, 2011 12:37
Google Book Search and Millennium
<html>
<head>
<title>Meriam Library - CSU, Chico /All Locations</title>
</head>
<body>
</script>
@dtjohnso
dtjohnso / ParseXML.bas
Created May 3, 2011 21:09
Trying to grab XRECORD via MARC callnum
'Similar to Query, but using WinHttpRequest 5.1
Private Function HttpRequest(url As String) As String
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
objHTTP.Open "GET", url, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("")
HttpRequest = objHTTP.responseText
End Function
Private Sub testget()
@dtjohnso
dtjohnso / logos-resources.bib
Last active December 26, 2015 05:49
Bibtex file for my Logos library
@misc{Comfort_Barrett_2001,
place={Wheaton, IL},
title={0162},
journal={The text of the earliest New Testament Greek manuscripts},
publisher={Tyndale House},
author={Comfort, Philip Wesley and Barrett, David P.},
year={2001}}
@misc{Comfort_Barrett_2001,
place={Wheaton, IL},
title={0171},