Skip to content

Instantly share code, notes, and snippets.

View mjlassila's full-sized avatar

Matti Lassila mjlassila

View GitHub Profile
@mjlassila
mjlassila / account_overview.en.tpl
Last active August 29, 2015 13:55
Finnan ohjetekstit.
<!-- START of: Content/account_overview.en.tpl -->
{assign var="title" value="JYKDOK help – Login and My account"}
{capture append="sections"}
{literal}
<h2 title="login">Login</h2>
<p>Login to JYKDOK if you want to manage your personal account details, loans, payments and reservation transactions, renew your loans, or place reservations. When logged in, you can save your searches and favourites for later use. JU students and staff can also use library e-materials from off campus with their own user accounts.</p>
<p>Click on <strong>Login</strong> to log into JYKDOK using either your library card or user account.</p>
<p><strong>Login with library card</strong></p>
<ul>
@mjlassila
mjlassila / MarcRecordLocal.php
Last active August 29, 2015 13:55
Vufind-Finna MarcRecord.php modifications for sorting holdings etc.
<?php
require_once 'RecordDrivers/MarcRecord.php';
/**
 * Local MarcRecord modifications.
 */
class MarcRecordLocal extends MarcRecord
{
/**
* Assign necessary Smarty variables and return a template name to
* load in order to display holdings extracted from the base record
import module namespace functx="http://www.functx.com";
declare option output:indent "no";
declare option output:item-separator "\n";
declare option output:method "text";
(: Käydään dumppi läpi tietue kerrallaan:)
for $record in /OAI-PMH/ListRecords/record/metadata/record
(: Muuttujaan talteen kaikki tietueen kentän 593 arvot.:)
(: On otettava huomioon, että 593-kenttiä voi olla useampi :)
(: Kentässä kurssikoodeja voi olla useita, pilkulla erotettuna :)
let $raw_course_codes:=$record/datafield[@tag="593"]/subfield[@code='a']
# ISBN 13 to 10 conversion, based on http://blog.mikezhang.com/2010/01/28/converting-isbn13-to-isbn10
sub isbn1310 {
my $isbn13=shift;
my @isbn13=split(//,$isbn13);
my $sum =
($isbn13[3] * 10) +
(9 * $isbn13[4]) +
(8 * $isbn13[5]) +
#include<stdio.h>
int main() {
int h,ib,th,hak,kl;
printf("hesap no gırın (çıkıs -1 ):\n");
scanf("%d",&h);
while(h!=-1) {
printf("ilk bakiyeyi gir:\n");
@mjlassila
mjlassila / marc-generator.xqm
Created May 5, 2014 08:20
XQuery module for creating MARC21 records
module namespace marc = 'app.marc.generator';
declare function marc:zero-prefix-time($timestamp as xs:string) {
let $time:=xs:string($timestamp)
let $prefixed_time:=
if(string-length($time) < 2) then
concat(0,$time)
else $time
return $prefixed_time
@mjlassila
mjlassila / filter-fennica-holdings.xq
Last active August 29, 2015 14:01
For filtering Fennica items without holdings
declare option output:method "text";
declare option output:item-separator "\n";
declare function local:filter-leader($string as xs:string) as xs:boolean? {
if(substring($string,7,1) eq 'a'and substring($string,8,1) eq 'm') then
boolean(1)
else()
};
declare function local:filter-holdings-949($fields as node()*) as xs:boolean?{
@mjlassila
mjlassila / general-post-body.tpl
Created September 10, 2014 08:31
E-kirjojen ja muiden kokotekstien kokotekstilinkkien klikkausten Google Analytics -seuranta Finnassa
<!-- START of customized: general-post-body.tpl -->
<script type="text/javascript">
{literal}
$(document).ready(function(){
$('a.fulltext').click(function() {
var url = $(this).attr('href');
ga('send', 'event', 'outbound', 'fulltext', url);
});
});
# tapei.conf
description "This is a *very* simple elevator implementation serving as a starting point for code-story S03E01"
start on startup
stop on shutdown
script
echo $$ > /var/run/tapei.pid
@mjlassila
mjlassila / VoyagerRestfulLocal.php
Last active August 29, 2015 14:15
Local modifications for VoyagerRestful Finna/Vufind -driver
<?php
/**
* Voyager ILS Driver modifications for displaying purchase order information
*
* @category VuFind
* @package ILS_Drivers
* @author Andrew S. Nagy <vufind-tech@lists.sourceforge.net>
* @author Demian Katz <demian.katz@villanova.edu>
* @author Matti Lassila
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License