Skip to content

Instantly share code, notes, and snippets.

View jens-a-e's full-sized avatar

jens alexander ewald jens-a-e

View GitHub Profile
// traverse a given DOM Node and log it's children recursively
function logChildNodes(node){
for (var c=0; c<node.childNodes.length; c++){
if (node.childNodes[c].nodeName!='#text')
console.log(node.childNodes[c].nodeName+", "+node.childNodes[c].id)
if (node.hasChildNodes())
logChildNodes(node.childNodes[c])
}
}
@jens-a-e
jens-a-e / BaseProject.pde
Created December 14, 2010 12:36
Simple Sketch Base for Processing
/**********************************************
* Simple Sketch Base for interactive Projects
* done in Processing http://processing.org
*********************************************/
/**
* Declare your variables here:
*/
int var; // For example
@jens-a-e
jens-a-e / Processing Preferences Extra
Created December 14, 2010 13:24
Hidden Preferences for Processing
// makes the font in the editors anti-alias:
editor.antialias=true
//sets the font for the editor on processing, e.g.:
editor.font=LMMonoLt10-Regular,plain,20
// or platform specific
editor.font.macosx=LMMonoLt10-Regular,plain,20
@jens-a-e
jens-a-e / Array.unique.js
Created January 6, 2011 17:58
Make an Array with unique members in javascript
/* Make an Array with unique members */
Array.prototype.unique = function(){
return this.filter(function(){return arguments[2].indexOf(arguments[0],arguments[1]+1)<0})
}
@jens-a-e
jens-a-e / SED-renamer
Created January 7, 2011 13:55
Using sed to rename files in more or less one line ;)
# for example ".bak"
TOKEN=.bak
ETOKEN=`echo $TOKEN |sed 's/\./\\\./'`
# any suggestions how to get rid of this "bash" at the end are appreciated
# also: alternatively there is a NOT opperator on sed's regex - not used here
find . -path "*$TOKEN" -d 1 |sed 's/^\.\(.*\)\($ETOKEN\)$/mv `pwd`\1\2 `pwd`\1/'|bash
@jens-a-e
jens-a-e / hellouniverse.sh
Created January 24, 2011 16:33
simple line
echo "hello world" > /dev/universe && exit
@jens-a-e
jens-a-e / ProcessingArrayList-Example.pde
Created January 24, 2011 16:47
How to use a static type on an ArrayList for easy iteration
// Given we need a list of things of the same type (our class "Rect") we should do:
ArrayList<Rect> listOfRects = new ArrayList();
// then we can easily iterate over this list with:
for (Rect r : listOfRects)
{
r.someFancyMethod();
}
/**
* A real quick shot for syntax highlighting via highlight.js on any page
* Unobtrusive, once loaded, anything goes.
*
* Version 0.0.1a, jens a. ewald, ififelse.net, www.muthesius.de, (cleft) 2011
*
*/
// the script
$.getScript('http://yandex.st/highlightjs/5.16/highlight.min.js',function(){
// defautl language?
/**
* My Program
*/
void setup(){
smooth();
size(300,300);
}
void draw(){
@jens-a-e
jens-a-e / ChromiumUpdater.sh
Created February 18, 2011 22:51
Updates Chromium for OS X from the latest build
#!/bin/bash
# =================================================================
# = Update to the latest version fo chromium - fresh from the bot =
# = Based on a MacOS X Hint: =
# = http://hints.macworld.com/article.php?story=20090604081030791 =
# =================================================================
echo "Updating to latest version of Chromium."