Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephan Bösch-Plepelits plepe

View GitHub Profile
View json_readable_encode.php
<?php
/*
json readable encode
basically, encode an array (or object) as a json string, but with indentation
so that i can be easily edited and read by a human
THIS REQUIRES PHP 5.3+
Copyleft (C) 2008-2011 BohwaZ <http://bohwaz.net/>
View tilegrid.html
<!DOCTYPE HTML>
<html>
<head>
<script src="lib/ol3/ol.js"></script>
<link rel="stylesheet" href="lib/ol3/ol.css" type="text/css">
<script>
window.onload = function() {
var map = new ol.Map({
target: "map",
view: new ol.View({
View Automatisch Diagramme in Excel anlegen
Function DiagrammAnlegen(ws, i)
Dim curgem As Integer
' Konfiguration auslesen
anz_gem = WorkSheets(ws).Range("G9").Value
first_kz = WorkSheets(ws).Range("G10").Value
last_kz = WorkSheets(ws).Range("G11").Value
delta_gem = WorkSheets(ws).Range("G12").Value
' Chart anlegen und selektieren
@plepe
plepe / README.creole
Created Dec 15, 2010
This GIST has been moved to a repository: https://github.com/plepe/wgetar
View README.creole

Often you need to download and extract archives from the internet, e.g. to install Drupal modules. Therefore you download the archive, extract it and remove the original archive. Using modern[tm] UNIX pipes you can directly pipe it to tar; therefore you don't need to save and remove the archive.

Example:

user@host> wgetar http://ftp.drupal.org/files/projects/views-7.x-3.5.tar.gz

See the result: {{{ user@host> ls -R

@plepe
plepe / get_proc_children.php
Created Aug 31, 2012
A function, returning an array of process ids of children (and their children, ...) of a process
View get_proc_children.php
<?php
function get_proc_children($pid, $tree=null) {
$tree=array();
$ret=array();
// build process tree in $tree
if($tree==null) {
$p=popen("ps eo pid,ppid", "r");
while($r=fgets($p)) {
if(preg_match("/^\s*([0-9]+)\s+([0-9]+)/", $r, $m)) {
@plepe
plepe / gist:4148833
Created Nov 26, 2012
Commons - von der Informatik in die Raumplanung
View gist:4148833

Commons in der Informatik: Die „Free and Open Source Software“ Bewegung

Um Anwendungsmöglichkeiten für das Commons-Prinzip in der Raumplanung zu finden, ist es hilfreich sich Anwendungen in anderen gesellschaftlichen Bereichen anzusehen; zum Beispiel in der noch relativ jungen Branche Informatik. Dort spielt das Commons-Prinzip besonders in der Softwareentwicklung und in der Wissensgeneration eine große Rolle.

Digitale Information - zu dieser zählt Software - hat das Herausstellungsmerkmal, dass sie unendlich vervielfältigbar ist, ohne einen technischen Qualitätsverlust zu erleiden - im Gegensatz zu Raum, der eine beschränkte Ressource ist.

Das bedeutet aber auch, dass das Vervielfältigen von Information nur künstlich beschränkt werden kann. Das möchte man z.B. zur Kommerzialisierung von Inhalten (wie Computerprogrammen oder digitalen Inhalte wie Filme und Bücher), aber auch aus Datenschutzgründen (Stichwort: Gläserner Mensch). Diese k

@plepe
plepe / gist:7632178
Last active Dec 29, 2015
Error log when compiling mod_tile with Mapnik 2.3.x (see: https://github.com/openstreetmap/mod_tile/issues/55)
View gist:7632178
Making all in iniparser3.0b
make[1]: Entering directory `/home/skunk/mod_tile/iniparser3.0b'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/skunk/mod_tile/iniparser3.0b'
make[1]: Entering directory `/home/skunk/mod_tile'
g++ -DHAVE_CONFIG_H -I. -I./includes -I/usr/include/freetype2 -pthread -I/usr/local/include -I/usr/local/include/mapnik/agg -I/usr/include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT gen_tile.o -MD -MP -MF .deps/gen_tile.Tpo -c -o gen_tile.o `test -f 'src/gen_tile.cpp' || echo './'`src/gen_tile.cpp
In file included from /usr/include/c++/4.8/mutex:35:0,
from /usr/local/include/mapnik/config.hpp:56,
from /usr/local/include/mapnik/color.hpp:27,
from /usr/local/include/mapnik/map.hpp:27,
@plepe
plepe / __FILE__.js
Created Oct 15, 2012
__FILE__ in JavaScript
View __FILE__.js
/***
* This gist provides a __FILE__ variable, which holds the path to the file
* from which the currently running source is being executed.
*
* Usage example: alert(__FILE__);
*
* Thanks to http://ejohn.org/blog/__file__-in-javascript/ on which this gist
* is based on.
*
* Tested in Mozilla Firefox 9, Mozilla Firefox 16, Opera 12, Chromium 18
@plepe
plepe / testfind.js
Created Mar 2, 2017
pouchdb-find error with elemMatch and array of objects
View testfind.js
#!/usr/bin/env node
var async = require('async')
var PouchDB = require('pouchdb')
PouchDB.plugin(require('pouchdb-find'))
var db = PouchDB('foobar')
async.series([
// drop database and re-create (always start with new database)
@plepe
plepe / report.md
Created Oct 12, 2018
How I migrated Drupal 6 (with Biblio module) to Drupal 8 (with Bibcite module)
View report.md

How I migrated Drupal 6 (with Biblio module) to Drupal 8 (with Bibcite module)

I got the task of upgrading an old Drupal 6 webpage to a newer version. We decided to skip Drupal 7 and go directly for Drupal 8 with the new bibcite module (although it is still at 1.0-alpha7 at the time of this writing).

Upgrading most of the content of Drupal 6 to Drupal 8 worked rather fine, with the exception of the Views which have to be migrated separately. Migrating the content of the biblio to bibcite was quite a task though. In this text, I will report how I did the transition.

One of the biggest hurdles was, that the migration would split the publications into two separate entitys. In Drupal 6, there was a "Biblio" content type, which had a "biblio" field with all the bibliographic sub-fields. And there were a fewer custom fields (via CCK), e.g. a teaser image and some node references to projects (which were a separate content type).

After the migration, the publications are a separate entity type (Content -> Biblio

You can’t perform that action at this time.