Skip to content

Instantly share code, notes, and snippets.

View jthoenes's full-sized avatar
👣

Johannes Thönes jthoenes

👣
View GitHub Profile
@jthoenes
jthoenes / imageStorage.js
Created March 13, 2014 09:18
API for image storage function of Redactor Feature Request
var storeImageLocally = function(imageFile, callback){
// result of asynchronous call which will store the file
var result = {
localUrl: 'filesystem:http://localhost:9000/persistent/someImage.jpg',
imageId: 'generated uid'
}
// call the callback with html to insert into redactor
callback('<img src="'+result.localUrl+'" data-image-id="'result.imageId'">');
}
@jthoenes
jthoenes / report.js
Last active August 29, 2015 14:21 — forked from renatoargh/report.js
// http://www.highcharts.com/docs/export-module/render-charts-serverside
'use strict';
var PdfPrinter = require('pdfmake'),
printer,
moment = require('moment-timezone'),
path = require('path'),
fs = require('fs');
function resolvePath(relative) {
@jthoenes
jthoenes / gist:67736
Created February 20, 2009 22:11 — forked from jseifer/gist:67727
On Feb 20, 2009, at 4:24 PM, "Olusegun A.A" <xxxxxx@gmail.com> wrote:
** CRAIGSLIST ADVISORY --- AVOID SCAMS BY DEALING LOCALLY
** Avoid: wiring money, cross-border deals, work-at-home
** Beware: cashier checks, money orders, escrow, shipping
** More Info: http://www.craigslist.org/about/scams.html
Hello,
Do you still have this item available for sale at the moment? Get back asap.
@jthoenes
jthoenes / upgrade_dokuwiki.rb
Created January 24, 2010 14:14
Update multiple dokuwiki installations via a ruby script
#! /usr/bin/env ruby
=begin
This script backups and updates all dokuwiki installations on this server
Copyright (c) 2010 by Johannes Thönes <johannes.thoenes@googlemail.com>
Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
=end
# Library Requirements
require 'net/http' # for download of the files
require 'open-uri' # for download of the files
svn log | ruby -e "puts STDIN.read.split(/\n/).select{|l| l =~ /^r\d+/}.map{|l| l.split('|')[1].strip}.uniq.sort"
@jthoenes
jthoenes / insertion_sort_classical.scala
Created October 22, 2010 22:11
Insertion Sort Implementations in Scala
def insertionSort(unsortedList : List[String]) = {
val F = unsortedList.toArray
for(i <- (2 until F.length)){
val m = F(i)
var j = i;
while(j > 1 && !sorted){
if (F(j-1) >= m) {
F(j) = F(j-1)
j -= 1
}
public static <l> L[] createHeapPollution(L... args) {
Object[] elements = args;
elements[0] = Arrays.asList(12, 12);
return args;
}
public static void main(String... args) {
List<string>[] polluted = createHeapPollution(Arrays.asList("a", "b", "c"));
// java.lang.Integer cannot be cast to java.lang.String
finally {
try {
if (resultSet != null) {
resultSet.close();
}
} catch (SQLException ex) {
logger.error("Error in Database", ex);
} finally {
try {
@jthoenes
jthoenes / LambdaIntro.java
Created August 1, 2012 10:32
Testing the Lambda Water
package net.jthoenes.blog.spike.lambda;
import java.util.Arrays;
import java.util.List;
public class LambdaIntro {
public static interface ItemWithIndexVisitor<E> {
public void visit(E item, int index);