Skip to content

Instantly share code, notes, and snippets.

@james-huston
james-huston / socketclient.spec.js
Last active December 21, 2015 22:59
Test and angular service by injecting a fake mock dependency
describe('When using the SocketClient provider', function () {
var client, mockEngineio, globalComms;
beforeEach(module(function ($provide) {
mockEngineio = {
connect: function (data) {
throw new Error('blarg!');
},
$get: function () {
console.log('boogers');
@james-huston
james-huston / gist:7206042
Last active December 26, 2015 20:09
grunt file that includes S3
module.exports = function (grunt) {
/**
* Load required Grunt tasks. These are installed based on the versions listed
* in `package.json` when you do `npm install` in this directory.
*/
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
@james-huston
james-huston / create-pre-commit.sh
Last active December 30, 2015 08:58
Git pre-commit hook for lint checking with grunt before allowing a commit. Add it as an install script to your package.json.
#!/bin/bash
if [ ! -f .git/hooks/pre-commit ]
then
echo "Adding pre-commit hook"
echo "#!/bin/sh" > .git/hooks/pre-commit
echo "grunt jshint; exit \$?" >> .git/hooks/pre-commit
chmod ug+x .git/hooks/pre-commit
fi
@james-huston
james-huston / package.json
Created December 5, 2013 14:13
Package.json entry for firing the pre-commit creator on npm install.
{
"name": "youproject",
"version": "0.0.1",
"description": "some cool stuff",
"main": "index.js",
"scripts": {
"install": "bash scripts/pre-commit.sh"
}
}
@james-huston
james-huston / wifinodisco.sh
Created December 16, 2013 14:52
Stop mac wifi from disconnection on sleep/logout
#!/bin/bash
cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
sudo ./airport en0 prefs DisconnectOnLogout=NO
@james-huston
james-huston / debug.sh
Created December 23, 2013 16:10
restart a node process in debug mode
# find the pid, in this case 4333.
# this will start the debug port on 5858
kill -s SIGUSR1 4333
# start the command line debugger
node debug -p 4333
# or start node-inspector
node-inspector
@james-huston
james-huston / profile.sh
Created December 30, 2013 20:01
emoticons for fun stuff
alias idunnolol="echo -n '¯\(°_o)/¯' | pbcopy"
alias disapproval="echo -n 'ಠ_ಠ' | pbcopy"
alias fliptable="echo -n '(╯°□°)╯︵ ┻━┻' | pbcopy"
@james-huston
james-huston / .bash_profile
Last active January 2, 2016 11:59
Some bash alias trickery for firing up ssh-agent and adding your keys on a mac
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin
# source ~/.profile, if available
{
"esnext": true,
"node": true,
"laxcomma": true,
"laxbreak": true,
"camelcase": false,
"indent": 2,
"newcap": true,
"quotmark": "single",
"unused": "vars",
{
"esnext": true,
"node": true,
"laxcomma": true,
"laxbreak": true,
"camelcase": false,
"indent": 2,
"newcap": true,
"quotmark": "single",
"unused": "vars",