Skip to content

Instantly share code, notes, and snippets.

View choffmeister's full-sized avatar

Christian Hoffmeister choffmeister

View GitHub Profile
@choffmeister
choffmeister / VisitorGenerator.cs
Created January 30, 2013 11:49
Generates source code for a Visitor
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Choffmeister.Utils
{
public static class VisitorGenerator
{
@choffmeister
choffmeister / monodevelop4-build.sh
Last active December 14, 2015 16:28
Install MonoDevelop 4 under Ubuntu 12.04 LTS from sources
#!/bin/bash
sudo apt-get install build-essential automake checkinstall intltool git
sudo apt-get install mono-complete mono-addins-utils gtk-sharp2 gnome-sharp2
git clone git://github.com/mono/monodevelop
cd monodevelop
git checkout monodevelop-4.0
git submodule update --init --recursive
./configure
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
namespace NUnitTest
{
[AttributeUsage (AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
public sealed class EnumParameterValueAttribute : ParameterDataAttribute
/*
* Copyright (C) 2013 Christian Hoffmeister
*
* This program 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
& eval 'exec perl -wS "$0" $argv:q'
if 0;
# Convert git log output to ChangeLog format.
my $VERSION = '2012-07-29 06:11'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
@choffmeister
choffmeister / bulk-iconv.py
Created May 23, 2014 13:26
Mass converts file encodings. Allows include filters and exclude filters.
#!/usr/bin/python
# The MIT License (MIT)
# Copyright (c) 2014 Christian Hoffmeister
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
var argv = require('yargs').argv,
bower = require('main-bower-files'),
coffee = require('gulp-coffee'),
concat = require('gulp-concat'),
connect = require('connect'),
filter = require('gulp-filter'),
gif = require('gulp-if'),
gulp = require('gulp'),
gutil = require('gulp-util'),
jade = require('gulp-jade'),
Bluebird.prototype.flatThen = function (promise, transform) {
return new Bluebird(function (resolve, reject) {
promise
.then(function (value1) {
transform(value1)
.then(function (value2) {
resolve(value2);
})
.catch(function (err2) {
reject(err2);
@choffmeister
choffmeister / mock-router.js
Last active October 25, 2015 10:16
A simple mock router implementation
// The MIT License (MIT)
// Copyright (c) 2015 Christian Hoffmeister
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
path("test") {
extract(ctx => ctx.request.entity.dataBytes) { body =>
complete {
val processing = body
.map { chunk =>
//println(s"Received ${chunk.length} bytes")
chunk
}
.map { chunk =>
// simulate slow processing speed