Skip to content

Instantly share code, notes, and snippets.

View steren's full-sized avatar

Steren steren

View GitHub Profile
steren /
Created November 3, 2010 10:22
Upload and store image with Play! Framework
public class Application extends Controller {
public static void index() {
public static void uploadPicture(Picture picture) {;
steren / index.html
Created November 18, 2010 02:24
call Wikipedia API using jQuery and parse result
<div id="insertTest"></div>
var wikipediaHTMLResult = function(data) {
var readData = $('<div>' + data.parse.text.* + '</div>');
// handle redirects
var redirect = readData.find('li:contains("REDIRECT") a').text();
if(redirect != '') {
steren /
Created April 13, 2011 15:36
Create a controller and a generator to create your sitemap
package helpers;
public class RenderSitemap extends RenderSitemapXml {
public RenderSitemap(List<User> users) {
private static Document getDocument(List<User> users) {
Document doc = createSiteMapDocument();
steren / balsamiq.svg
Created August 24, 2011 09:41
Balsmiq Mockup style made with Inkscape
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
steren / Dives.html
Created August 26, 2011 20:14
Convert an export from Google spreadsheets to JSON objects, used for my diving log.
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<script src=""></script>
<script url="" ></script>
<script src=""></script>
<script type="text/javascript">
steren / gist:1538982
Created December 30, 2011 09:35
Git: compare a local branch with upstream repository
git fetch upstream && git diff remotes/upstream/master master > changes.diff
steren / voyagessncf.css
Created February 9, 2012 21:52 more is less
@-moz-document domain("") {
/* Delete */
/* main */
steren /
Created March 1, 2012 13:57
Android screen size
// if API level > 13, we can use this:
// Point outSize = new Point();
// display.getSize(outSize);
DisplayMetrics displaymetrics = new DisplayMetrics();
int ht = displaymetrics.heightPixels;
int wt = displaymetrics.widthPixels;
// Determine screen size
steren / imageprocessing-boilerplate.html
Created June 25, 2012 23:01
Image processing JS boilerplate for Xavier
<p>Code to help you with <a href="">this tutorial</a>.</p>
<p>To manipulate image pixels, run Chrome with "web security" disabled. On a mac, terminate your existing Chrome, then type in a terminal: <code>$ open -a Google\ Chrome --args --disable-web-security</code></p>
<img id="orig" src="" width="600" height="337">
<figcaption>The original test image</figcaption>
<h2>Processing pixels</h2>
steren / onlyone.html
Created January 26, 2013 00:03
Josephus problem illustration and formula test
<!DOCTYPE html>
<script src=""></script>
<link type="text/css" rel="stylesheet" href="">
<script src=""></script>
<script src=""></script>
<meta charset=utf-8 />