Skip to content

Instantly share code, notes, and snippets.

View andfaulkner's full-sized avatar
🐻
Working from home

Andrew Faulkner andfaulkner

🐻
Working from home
  • Ottawa Health Research Institute: mHealth lab (@Ottawa-mHealth)
  • Ottawa, Ontario
View GitHub Profile
@andfaulkner
andfaulkner / GULP-list-all-tasks-registered.js
Created August 28, 2015 09:34
Gulp task that lists all gulp tasks registered (excluding built-ins 'install' and 'uninstall')
require('colors');
gulp.task('get-tasks', () =>
(process.nextTick(() => {
console.log('\n_________ALL REGISTERED GULP TASKS_________');
Object.keys(gulp.tasks).forEach((t) =>
((t === 'install' || t === 'uninstall') ? null :
console.log('-- ' + t.bgBlack.green)))
console.log('___________________________________________\n');
})));
@andfaulkner
andfaulkner / bash-utils.sh
Created July 30, 2015 06:15
Bash npm utils
#find version of globally installed package
alias npmpv="npm list -g | grep"
#add new alias to bashrc, also make immediately available
function newalias {
echo "" >> ~/.bashrc
echo "" >> ~/.bashrc
echo 'alias' ${1}='"'${2}'"' >> ~/.bashrc
$(echo 'alias' ${1}'='${2})
}
/**
* Custom Lodash functions for transforming http GET requests
*/
_.mixin({
//Shifts an item in an array from one location in an array to another
move: function (array, fromIndex, toIndex) {
array.splice(toIndex, 0, array.splice(fromIndex, 1)[0] );
return array;
},
@andfaulkner
andfaulkner / hasContent.js
Created February 3, 2015 20:51
Comprehensive Javascript detector of whether a variable contains actual content
//Comprehensive check for whether or not a Javascript variable has actual content
var hasContent = function(input) {
if (typeof input === 'number') {
if (isNaN(input)) {
return false;
};
} else {
if (input === 0) {
return false;
}