Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
### BEGIN INIT INFO
# Provides: playframework
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop playframework
### END INIT INFO
#
@michiel
michiel / nvm.zsh
Created March 25, 2015 08:18
nvm project-specific
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# Try to load via project-specific .nvmrc
nvm use > /dev/null 2>&1
if [ $? -ne 0 ]; then
# Use default - set with 'nvm alias default v0.12.1'
nvm use default
fi
@michiel
michiel / freqplot-galton.R
Created March 21, 2015 15:52
Galton parent/child frequency plot
library(HistData)
galton <- Galton
y <- galton$child
x <- galton$parent
freqData <- as.data.frame(table(galton$child, galton$parent))
names(freqData) <- c("child", "parent", "freq")
plot(as.numeric(as.vector(freqData$parent)),
as.numeric(as.vector(freqData$child)),
pch = 21, col = "black", bg = "lightblue",
// based on http://onais-m.blogspot.nl/2014/10/automatic-graph-layout-with-javascript.html
var jsp = jsPlumb.getInstance();
// construct dagre graph from JsPlumb graph
/* global dagre */
var g = new dagre.graphlib.Graph();
g.setGraph({});
g.setDefaultEdgeLabel(function() { return {}; });
$('.xnode').each(
@michiel
michiel / show-react.js
Last active August 29, 2015 14:16
Show ReactJS elements
setInterval(
function() {
Array.prototype.slice.call(
document.querySelectorAll('[data-reactid]')
).forEach(function(element) {
element.style.background = 'rgba(255,0,0,0.1)';
});
}, 500
);
@michiel
michiel / list-angular-modules.js
Created February 16, 2015 15:09
list-angular-modules
function listServices(mod, r) {
var inj = angular.element(document).injector().get;
if (!r) {
r = {};
}
angular.forEach(angular.module(mod).requires,
function(m) {
listServices(m,r)
});
angular.forEach(angular.module(mod)._invokeQueue,
@michiel
michiel / connect-bower.js
Last active January 13, 2016 15:37
Serve bower_components outside app root with grunt-contrib-connect
connect: {
app: {
options: {
port : 9000,
base : '<%= appRoot %>/',
open : true,
livereload : true,
hostname : '127.0.0.1'
middleware : function(connect) {
return [
@michiel
michiel / android-studio.desktop
Created January 19, 2015 08:51
gnome3 desktop android-studio
[Desktop Entry]
Type=Application
Name=Android Studio
Comment=Android Studio Integrated Development Environment
Icon=/opt/android-studio/bin/androidstudio.ico
Exec=/opt/android-studio/bin/studio.sh
Terminal=false
Categories=Development;IDE;Java;Android
@michiel
michiel / eclipse.desktop
Created January 18, 2015 20:35
eclipse gnome3 desktop
# .local/share/applications/eclipse.desktop
[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=/opt/eclipse/icon.xpm
Exec=/opt/eclipse/eclipse
Terminal=false
Categories=Development;IDE;Java;
@michiel
michiel / clean-xml.rb
Created January 11, 2015 14:27
clean-xml.rb
require 'nokogiri'
file = File.read("dirty.xml")
xml = Nokogiri::XML(file)
# xml.xpath("//location").each do |node|
# node.content = node.content.gsub(/\n\s+/, " ")
# end
File.open("clean.xml", "w") do |f|