Skip to content

Instantly share code, notes, and snippets.

View StevenLooman's full-sized avatar

Steven Looman StevenLooman

  • The Netherlands
View GitHub Profile
@StevenLooman
StevenLooman / analyze_all.sh
Created November 7, 2012 20:57
Wrapper script to analyze Python (Plone) egg or sources with Sonar
#!/usr/bin/env bash
for D in *; do
if [ -d "${D}" ]; then
cd ${D}
~/src/plone-sonar-runner.sh
cd ..
fi
done
@StevenLooman
StevenLooman / erroring_parseInt.js
Created October 5, 2012 14:13
parseInt which throws an error when string is not parsable
function (string, radix) {
var result = window._parseInt(string, radix);
if (isNaN(result)) {
throw new Error('Unable to parse int');
}
return result;
}
@StevenLooman
StevenLooman / match.magik
Created July 20, 2012 18:59
The classic match(), version in Smallworld/Magik
#/* matchere: search for regexp at beginning of text */
#int matchhere(char *regexp, char *text) {
# if (regexp[0] == '\0')
# return 1;
# if (regexp[1] == '*')
# return matchstar(regexp[0], regexp+2, text);
# if (regexp[0] == '$' && regexp[1] == '\0')
# return *text == '\0';
# if (*text!='\0' && (regexp[0]=='.' || regexp[0]==*text))
# return matchhere(regexp+1, text+1);
@StevenLooman
StevenLooman / wfs_to_geojson.xsl
Created March 3, 2012 15:09
XSLT converting WFS output to GeoJSON
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:rws="http://mapserver.gis.umn.edu/mapserver">
<xsl:output method="text" />
<xsl:template match="/wfs:FeatureCollection">
@StevenLooman
StevenLooman / no_id.js
Created January 18, 2012 08:35
Exposing Mongoose missing ID on save bug - simpler version
var mongoose = require('mongoose');
var eyes = require('eyes');
mongoose.connect('mongodb://localhost/null_id');
// schema definition
var A = new mongoose.Schema({
f1: String,
@StevenLooman
StevenLooman / no_id.js
Created January 17, 2012 21:51
Exposing Mongoose missing ID on save bug
var mongoose = require('mongoose');
var eyes = require('eyes');
mongoose.connect('mongodb://localhost/null_id');
// schema definition
var A = new mongoose.Schema({
f1: String,