Skip to content

Instantly share code, notes, and snippets.

View sanderversluys's full-sized avatar

Sander Versluys sanderversluys

View GitHub Profile
@sanderversluys
sanderversluys / tile.sh
Created November 16, 2014 22:05
Split image in tiles with ImageMagick
#!/bin/bash
file=$1
function tile() {
convert $file -scale ${s}%x -crop 256x256 \
-set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" \
+repage +adjoin "${file%.*}_${s}_%[filename:tile].${file#*.}"
}
s=100
tile
s=50
@sanderversluys
sanderversluys / BlurTransform.java
Created October 21, 2014 10:03
Picasso Blur Transform
import android.graphics.Bitmap;
import android.util.Log;
import com.squareup.picasso.Transformation;
/**
* Created by Sander Versluys on 21/10/14.
*/
public class BlurTransform implements Transformation {
var boysSection = false;
var test = $('#mw-content-text p a').map(function(data, w) {
var $name = $(w);
var name = $name.text();
if (name == "Aad") boysSection = true;
var isBoy = boysSection || $('*:contains("'+name+' (+m)")').length > 0;
var isGirl = !boysSection || $('*:contains("'+name+' (+v)")').length > 0;
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include jni/libobj/Android.mk
include jni/libpng/Android.mk
include jni/libzip/Android.mk
include jni/freetype/Android.mk
include jni/ftgles/Android.mk
include jni/qcar/Android.mk
@sanderversluys
sanderversluys / twtcsv.py
Created June 26, 2012 08:04
Twitter to csv export script
import json
import urllib2
import unicodecsv
user = "ifsorbuts"
count = 100
output = "tweets.csv"
feed = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&screen_name={0}&count={1}".format(user, count)
@sanderversluys
sanderversluys / car-crash.html
Created May 31, 2012 15:26
Car crash calculator
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Car crash</title>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.8.20/themes/base/jquery-ui.css"/>
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.widget.Toast;
public class MySecretBroadcastReceiver extends BroadcastReceiver {
public static final String DEBUG_KEY = "DEBUG";
@sanderversluys
sanderversluys / MandelbrotZoom.html
Created February 21, 2012 09:59
MandelbrotZoom
<!DOCTYPE html>
<html>
<head>
<script>
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Mˆller
<!DOCTYPE html>
<html>
<head>
<style>
div.t { background-color: #ddd; position: absolute; }
</style>
<script>
window.addEventListener('load', function() {
@sanderversluys
sanderversluys / L-System2.html
Created February 20, 2012 14:19
L-System exploration 2
<!DOCTYPE html>
<html>
<head>
<script>
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Mˆller