Skip to content

Instantly share code, notes, and snippets.

View winterbe's full-sized avatar
🐺
I ♡ full stack programming!

winterbe

🐺
I ♡ full stack programming!
View GitHub Profile
@winterbe
winterbe / Nashorn6.java
Created April 1, 2014 18:03
Using Backbone Models from Nashorn JS Engine
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.
@winterbe
winterbe / Nashorn1.java
Created March 30, 2014 19:15
Java 8 Nashorn
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 July 9, 2013 15:39
Reading the Body Text of a javax.mail.Message
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 April 1, 2012 14:22 — forked from erikh/hack.sh
OSX For Hackers
#!/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 January 3, 2012 15:16
Convert all Java file encodings from windows1250 to UTF-8
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 January 15, 2011 12:04
Android custom painting and animations
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;
/**