View gulpfile.js
/**
"devDependencies": {
"babel-preset-es2015": "~6.6.0",
"babel-preset-react": "~6.5.0",
"babelify": "~7.2.0",
"browserify": "~4.2.0",
"gulp": "~3.9.0",
"gulp-notify": "~1.4.0",
"gulp-util": "~2.2.19",
"react": "~0.14.8",
View gist:7537030
var getURLParameter = function(name) {
var valStr = decodeURIComponent( (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[0,null])[1]);
return valStr === 'null' ? null : valStr;
};
View RasPi-blinkToggle.js
var gpio = require('gpio');
var header4, header17, intervalTimer;
header4 = gpio.export(4);
header17 = gpio.export(17, {
ready: function() {
intervalTimer = setInterval(function() {
header4.set();
setTimeout(function() { header4.reset(); }, 500);
}, 1000);
View ieversion.js
// capture x.x portion and store as a number, returns NaN if not IE
var IE = /MSIE (\d+\.\d+);/.test(navigator.userAgent) ? parseFloat(RegExp.$1) : NaN;
View .bash_profile
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
# Displays git branch next to directory path
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
View interfaceDeveloper.js
/* An implementation of the interface system in Javascript that takes a design form
similar to other popular object-oriented languages such as Java, C# and PHP. */
Function.prototype.implements = function(){
var class = this;
if(arguments.length < 1) {
throw new Error("Expecting interface as argument but found none.");
}
for (var i =0; i<arguments.length; i++){