Skip to content

Instantly share code, notes, and snippets.

Avatar
🐺
I ♡ full stack programming!

Benjamin Winterberg winterbe

🐺
I ♡ full stack programming!
View GitHub Profile
@winterbe
winterbe / Nashorn6.java
Created Apr 1, 2014
Using Backbone Models from Nashorn JS Engine
View Nashorn6.java
package com.winterbe.java8;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
/**
* Using Backbone Models from Nashorn.
View Nashorn1.java
package com.winterbe.java8;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.FileNotFoundException;
import java.io.FileReader;
/**
@winterbe
winterbe / gist:5958387
Created Jul 9, 2013
Reading the Body Text of a javax.mail.Message
View gist:5958387
private boolean textIsHtml = false;
/**
* Return the primary text content of the message.
*/
private String getText(Part p) throws MessagingException, IOException {
if (p.isMimeType("text/*")) {
String s = (String)p.getContent();
textIsHtml = p.isMimeType("text/html");
@winterbe
winterbe / hack.sh
Created Apr 1, 2012 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@winterbe
winterbe / iconv-all.sh
Created Jan 3, 2012
Convert all Java file encodings from windows1250 to UTF-8
View iconv-all.sh
for i in `find . -type f -name "*.java" -print`;
do
iconv -f CP1250 -t UTF-8 $i > $i.new;
mv -f $i.new $i;
done
@winterbe
winterbe / Sample1View.java
Created Jan 15, 2011
Android custom painting and animations
View Sample1View.java
package de.winterberg.android.sandbox.sample1;
import android.content.Context;
import android.graphics.*;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
/**