Skip to content

Instantly share code, notes, and snippets.

View niclashoyer's full-sized avatar

Niclas Hoyer niclashoyer

View GitHub Profile
@niclashoyer
niclashoyer / height.sparql
Created May 5, 2013 10:59
SPARQL query to get the "height" or distance to a common parent class.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ldp: <http://www.w3.org/ns/ldp#>
PREFIX : <http://example.com#>
SELECT ?r (MIN(?h) AS ?height) WHERE {
VALUES ?r { :h0 :h1 :h2 :h3 :h4 :h5 :h6 }
VALUES ?p { ldp:Resource }
{
?r rdf:type ?p
@niclashoyer
niclashoyer / literate_coffee_script.lang
Last active December 10, 2015 21:18
Syntax highlighting for Literate CoffeeScript in gtksourceview, e.g. gedit.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Author: Niclas Hoyer <niclas@verbugt.de>
Copyright (C) 2012 Niclas Hoyer <niclas@verbugt.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
@niclashoyer
niclashoyer / dabblet.css
Created October 29, 2012 12:31
Responsive Test
/*
* Responsive Test
*/
/* reset */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}
/* stuff */
html { padding-top: 4em; counter-reset: item }
* { box-sizing: border-box }
@niclashoyer
niclashoyer / dabblet.css
Created October 21, 2012 20:16
Responsive Test
/*
* Responsive Test
*/
/* reset */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}
/* stuff */
html { padding-top: 4em; counter-reset: item }
* { box-sizing: border-box }
@niclashoyer
niclashoyer / policies.sparql
Created August 7, 2012 22:31
SPARQL Query for SHI3LD Access Policy Selection
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX s4ac: <http://ns.inria.fr/s4ac/v2#>
SELECT DISTINCT
?m ?p ?title ?protected ?privilege ?acs ?type ?query
WHERE {{
BIND('1' AS ?m)
?p a s4ac:AccessPolicy ;
s4ac:appliesTo ?protected .
OPTIONAL {
@niclashoyer
niclashoyer / createevent.sparql
Created June 28, 2012 11:54
Example SPARQL Queries for Events
PREFIX time:<http://www.w3.org/2006/time#>
PREFIX geo:<http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX foaf:<http://xmlns.com/foaf/0.1/>
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
PREFIX event:<http://purl.org/NET/c4dm/event.owl#>
INSERT DATA {
_:ev a event:Event ;
event:time _:time .
_:time a time:Interval ;
@niclashoyer
niclashoyer / classprop.sparql
Created June 22, 2012 17:51
SPARQL Query for Retrieving Classes with Properties
PREFIX dc:<http://purl.org/dc/elements/1.1/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX time:<http://www.w3.org/2006/time#>
PREFIX geo:<http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX foaf:<http://xmlns.com/foaf/0.1/>
PREFIX event:<http://purl.org/NET/c4dm/event.owl#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX vs:<http://www.w3.org/2003/06/sw-vocab-status/ns#>
select distinct ?class ?property ?label
@niclashoyer
niclashoyer / config.php
Created June 16, 2012 16:51
Get Magento Configurations as XML
<?php
/*
Put this file to /magento/shell/config.php and run
$ php shell/config.php | tidy -xml -i > config.xml
*/
require_once 'abstract.php';
@niclashoyer
niclashoyer / lsdumps.sh
Created June 16, 2012 11:01
Display gzipped SQL dumps from folder
#!/bin/bash
dir=/path/to/dumps
ending=sql.bz2
cd $dir
for file in *.$ending; do
time=$(date -d @`stat $file -c %Y` +%T)
size=$(du -sh $file | awk '{print $1}')
name=${file%%.$ending}
@niclashoyer
niclashoyer / githubtags.php
Created June 15, 2012 20:50
Get Tags of a GitHub Repository with links to Tarballs
#!/usr/bin/env php
<?php
$user = 'symfony';
$repo = 'symfony';
$url = 'https://api.github.com/repos/'.$user.'/'.$repo.'/tags';
$json = file_get_contents($url);