Skip to content

Instantly share code, notes, and snippets.

View dmj's full-sized avatar

David Maus dmj

View GitHub Profile
@dmj
dmj / test.php
Created September 26, 2012 10:54
Test vf2 search subsystem @ v0.6
<?php
require_once(realpath(__DIR__ . '/vendor/autoload.php'));
$sm = new \Zend\ServiceManager\ServiceManager(new \Zend\Mvc\Service\ServiceManagerConfig(array()));
$sm->setService(
'ApplicationConfig',
array(
'modules' => array('VuFindSearch'),
'module_listener_options' => array(
@dmj
dmj / gist:3889487
Created October 14, 2012 18:59
Highlight annotations in PHP
(defface php-annotations-annotation-face '((t . (:inherit 'font-lock-constant-face)))
"Face used to highlight annotations.")
(defconst php-annotations-re "\\(\\s-\\|{\\)\\(@[[:alpha:]]+\\)")
(defmacro php-annotations-inside-comment-p (pos)
"Return non-nil if POS is inside a comment."
`(eq (get-char-property ,pos 'face) 'font-lock-comment-face))
(defun php-annotations-font-lock-find-annotation (limit)
@dmj
dmj / gist:3944275
Created October 24, 2012 05:50
Support umlauts in ace-jump (hacky defadvice)
(defadvice ace-jump-char-category (around adv-ace-jump-support-umlauts activate)
(unless (= (char-syntax (ad-get-arg 0)) ?w)
ad-do-it)
(setq ad-return-value 'alpha))
@dmj
dmj / dnb-split.lisp
Created November 2, 2012 09:01
Split the German National Library's authority file in single entities
;;;
;; Split the German National Library's authority file in single entities
;;
;; The German National Library (DNB) published their authority file
;; under a CC0 license as one huge Turtle file. In order to work with
;; the data e.g. as training material for a machine learning based NER
;; of person names we need to split the file in the separate entities
;; (subjects).
;;
;; Number of single records: 9,493,986
@dmj
dmj / example
Created November 3, 2012 07:36
Proof of concept: XDebug trace parser
((return t)
(body ((call (depth 1)
(time "0.0008")
(memory "772760")
(function "main")
(parameter-list "")
(location "/var/www/workshop/wdb_copy/wdb.php:0")
(return "1")
(body ((call (depth 2)
(time "0.0008")
@dmj
dmj / output
Created November 17, 2012 11:14
YAML parsers vs. VuFind search specs
============================================================================
HORDE
Array
(
[AllFields] => Array
(
[Variant_1] => Array
(
[series] => Array
<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:pica="info:srw/schema/5/picaXML-v1.0">
<xsl:output method="xml" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
<?php
/**
* This file is part of HABfind.
*
* HABfind 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 3 of the License, or
* (at your option) any later version.
*
@dmj
dmj / gist:6403133
Created September 1, 2013 08:39
ANTLR4 grammer for PICA+ records
/* ANTLR4 Grammar for PICA+ records */
grammar PicaRecord ;
file : record ('\n' record)* ;
record : field+ ;
field : tag ' ' subfield+ '\u001e';
tag : FIELD_TAG ;
subfield : SUBFIELD ;
@dmj
dmj / example.pp
Last active December 26, 2015 07:39

001A 02012:18-04-12
001B 02012:04-05-12t16:13:28.000
001D 02012:31-08-98
001U 0utf8
001X 00
002@ 0Tuv1
003@ 0034034986
003U ahttp://d-nb.info/gnd/4510065-2
004B awit