Skip to content

Instantly share code, notes, and snippets.

View mlegenhausen's full-sized avatar

Malte Legenhausen mlegenhausen

View GitHub Profile
@mlegenhausen
mlegenhausen / .zshrc
Last active July 29, 2019 09:21
osx-install.sh
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_MODE="nerdfont-complete"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh docker_machine dir vcs newline nvm)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs time)
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
@mlegenhausen
mlegenhausen / gcr.zsh
Created November 21, 2017 08:07
Set of command line tools to work with the google container registry (GCR)
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
convert image.png -define icon:auto-resize="256,128,96,64,48,32,16" icon.ico
@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.

@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 / 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 / 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 / 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 / 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 / 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++) {