Skip to content

Instantly share code, notes, and snippets.

View dmj's full-sized avatar

David Maus dmj

View GitHub Profile
@dmj
dmj / *scratch*
Created December 9, 2009 10:28
emacs vs. zotero
(defun dmj/zotero-export-bibtex ()
"Ask for a search query, export matching items to bibtex."
(interactive)
(require 'moz)
(let* ((query (read-string "Query: "))
(tmpfile (make-temp-name
(expand-file-name "zotemacs" temporary-file-directory)))
(js (list
"var file = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);"
(concat
@dmj
dmj / .wl
Created December 12, 2009 15:14
;; Shimbun
;; Setup Feeds based on ~/.feeds
(let ((feedbuf (find-file-noselect "~/.feeds")))
(with-current-buffer feedbuf
(goto-char (point-min))
(while (re-search-forward "^\\([a\\|r]\\) \\([[:alnum:]]+\\) \\(.+\\)$" nil t)
(let ((sha (sha1-string (match-string 3))))
(cond
((equal (match-string 1) "a")
(add-to-list 'shimbun-atom-hash-group-path-alist
@dmj
dmj / psi-explain.xsl
Created September 30, 2011 11:35
Translate Pica PSI response to SRU response
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:explain="http://explain.z3950.org/dtd/2.0/"
xmlns:zs="http://www.loc.gov/zing/srw/"
version="1.0">
<xsl:output indent="yes" method="xml"/>
<xsl:param name="host" select="''"/>
<xsl:param name="port" select="''"/>
<xsl:param name="database" select="''"/>
@dmj
dmj / wl-auto-config.el
Created November 13, 2011 20:36 — forked from egh/wl-auto-config.el
wl auto config
;; Copyright 2011 Erik Hetzner
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@dmj
dmj / gist:2357640
Created April 11, 2012 07:40
Compare vanilla VuFind SOLR schema.xml to custom schema.xml
<?php
if (count($argv) != 3) {
die();
}
function load_schema ($path)
{
if (!file_exists($path)) {
die();
@dmj
dmj / gist:3206700
Created July 30, 2012 12:54
Lexvo language code tables to alist
(defun dmaus/lexvo/language-code-pairs (lexvo-file)
"Return alist of language codes in LEXVO FILE.
LEXVO-FILE is the path to a lexvo data file.
Each element of the alist is a cons with the ISO639-3 language
code in car and the file-specific language code in cdr."
(let (code-pairs)
(with-current-buffer (find-file-noselect lexvo-file)
(save-excursion
(goto-char (point-min))
@dmj
dmj / gist:3245746
Created August 3, 2012 08:18
Helper functions for eproject/phix-project
(defun dmaus/phix-project/jump-to-unit-test ()
(interactive)
(let ((project-root (eproject-root)))
(when project-root
(let ((unit-test-file
(expand-file-name
(concat (file-name-sans-extension (file-relative-name (buffer-file-name) (expand-file-name "src/php" project-root)))
"Test." (file-name-extension (buffer-file-name)))
(expand-file-name "src/tests/unit-tests/php" project-root))))
(switch-to-buffer (or (find-buffer-visiting unit-test-file)
@dmj
dmj / pre-commit
Created September 21, 2012 14:55 — forked from spulec/pre-commit
Yipit Pre-commit Hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@dmj
dmj / components.uml
Last active October 11, 2015 00:08
VF2 diagrams
@startuml components.png
title VuFind 2.x Components
skinparam component {
BackgroundColor<< Pica >> red
BackgroundColor<< DB >> orange
}
[Search/Manager] as SM
@dmj
dmj / pre-commit.sh
Created September 25, 2012 05:42
Git pre-commit, check coding style
#!/bin/zsh
### $Id:$
###
### Pre-commit hook for VuFind2
###
### Based on Z-Shell, maybe portable bash or sh.
###
### $Log:$
###