Skip to content

Instantly share code, notes, and snippets.

View mlegenhausen's full-sized avatar

Malte Legenhausen mlegenhausen

View GitHub Profile
@mlegenhausen
mlegenhausen / test.js
Created December 7, 2011 19:56
node-chain-gang issue #5
var chainGang = require('chain-gang');
var chain = chainGang.create();
var task = function(worker) {
worker.finish();
}
chain.add(task, function(err) {
console.log('Never called');
@mlegenhausen
mlegenhausen / gist:1446757
Created December 8, 2011 11:23
Chain-Gang Issue #7
var chainGang = require('chain-gang');
var queue = chainGang.create();
var longTask = function(text) {
return function(worker) {
setTimeout(function() {
console.log(text);
worker.finish();
}, 1000);
@mlegenhausen
mlegenhausen / app.js
Created August 12, 2012 15:52
JavaScript Workshop connect-four setup
(function(window, document, undefined) {
var $table = document.getElementById('field');
function columnClick(col) {
}
function buildTable() {
var $row, $col, i, j;
for (i = 0; i < ROWS; i++) {
@mlegenhausen
mlegenhausen / gist:6175299
Created August 7, 2013 15:46
WYMeditor directive for AngularJS
angular.module('directives.wymeditor', [])
.constant('WYM_EDITOR_OPTIONS', {
lang: 'de',
skin: 'compact',
iframeBasePath: 'vendor/wymeditor/iframe/pretty/',
logoHtml: '',
containersHtml: '',
classesHtml: '',
toolsItems: [
@mlegenhausen
mlegenhausen / gist:6176690
Created August 7, 2013 18:00
angular editor directive test
// Code goes here
angular.module('app', [])
.controller('AppCtrl', function($scope) {
$scope.content = '<p>Hallo Welt</p>';
})
.constant('KEY', {
'BACKSPACE': 8,
@mlegenhausen
mlegenhausen / android-adb-screen
Created January 16, 2014 09:39
Create an android screenshot from an remove device. Based on the article from http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
@mlegenhausen
mlegenhausen / ds
Created March 5, 2014 11:24
Get directory size via the command line on mac os and linux in a human readable format
#!/bin/sh
find $1 -type f -print0 | xargs -0 stat -f'%z' | awk '{b+=$1} END {print b}' | awk '{ sum=$1 ; hum[1024**3]="Gb";hum[1024**2]="Mb";hum[1024]="Kb"; for (x=1024**3; x>=1024; x/=1024){ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x];break } }}'
@mlegenhausen
mlegenhausen / gist:9743083
Created March 24, 2014 15:55
-cs-spinner angular loading directive using angular-promise-tracker and ui-router
angular.module('components.spinner-tracker', [
'ajoslin.promise-tracker'
])
.directive('csspinner', function (spinnerTracker) {
return {
scope: {
type: '@csspinner'
},
link: function (scope, element) {
@mlegenhausen
mlegenhausen / README.md
Created May 6, 2015 10:28
Ionic Modal Directive

This directive allows you to write you modal windows inline in your html code without writing the same boilerplate code for open and closing a popup. It also supports view caching and is scope destroy aware so you do not need to hide it manually when you switching a view.

convert image.png -define icon:auto-resize="256,128,96,64,48,32,16" icon.ico