Skip to content

Instantly share code, notes, and snippets.

View dalemanthei's full-sized avatar

Dale Manthei dalemanthei

  • Great White North, eh.
View GitHub Profile
@dalemanthei
dalemanthei / jasmine-window-decorator.js
Created January 24, 2016 22:18
Decorate $window to capture and count new window open events
// override the $window.open to count usage and prevent
// new windows from opening when running karma in watch mode
beforeEach(module(function ($provide) {
newWindow = {
location: {},
focusCalled: false,
closeCount: 0,
focus: function () {
newWindow.focusCalled = true;
},
@dalemanthei
dalemanthei / Jasmine-httpBackend-afterEach.js
Last active January 24, 2016 22:13
Standard afterEach $httpBackend checks for Jasmine
afterEach(function () {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
@dalemanthei
dalemanthei / .gitconfig
Created August 3, 2015 20:13
Git log commands (.gitconfig)
# list commands
le = log --oneline --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ls1 = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lds = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
@dalemanthei
dalemanthei / flex-layout.less
Created May 3, 2015 16:19
Simple CSS styles to keep separate layout from other CSS concerns. The fc-* class establishes the container, its direct descendents should apply one of the fi-* styles.
/* Vertical (column) Flex Container for actions
-------------------------------------------------- */
.fc-col {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
align-content: stretch;
align-items: stretch;
@dalemanthei
dalemanthei / String fill
Created April 6, 2015 16:56
String fill
function stringFill2(x, n) {
var s = '';
while (n-- > 0) s += x;
return s;
}
@dalemanthei
dalemanthei / pre-commit
Last active August 29, 2015 14:13
NodeJS version of pre-commit to run jshint, jscs, and simple scan
#!/usr/local/bin/node
var cp = require('child_process');
module.paths.push('/usr/local/lib/node_modules'); // hacky hacky hacky to get to async
var async = require('async');
var getJsFiles = 'git diff --cached --name-only --diff-filter=ACM | grep ".js$"';
cp.exec(getJsFiles, function (err, stdout, stderr) {
var failCount = 0;
@dalemanthei
dalemanthei / pre-commit
Created January 17, 2015 04:10
A git pre-commit hook to validate JavaScript
#!/bin/sh
if git-rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
jsfiles=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
if [ "$jsfiles" = "" ]; then
@dalemanthei
dalemanthei / gist:0238fce1b1a17edd32c0
Created January 1, 2015 19:47
Mailplane 3 to OmniFocus clipping
-- From a combination of gists
-- Configured as a Keyboard Maestro macro in Mailplane 3 group bound to ⌘⌥^⇧C
tell application "Mailplane 3"
set theEmailUrl to currentURL
set theGmailUrl to my replace_chars(theEmailUrl, "mailplane://dale.manthei%40gmail.com/", "https://mail.google.com/mail/u/0/")
set theSubject to currentTitle
tell application "OmniFocus"
set theTask to theSubject
@dalemanthei
dalemanthei / Flatland Dark.sublime-theme
Created December 20, 2014 20:35
Sublime Text 3 theme configuration to boost/set the status bar font size
{
"class": "label_control",
"parents": [{"class": "status_bar"}],
"color": [148, 149, 151],
"shadow_color": [200, 200, 200],
"shadow_offset": [0, 0],
"font.size": 15,
"font.bold" : false
},
@dalemanthei
dalemanthei / EsFormatter.sublime-settings
Created December 7, 2014 23:14
sprint-web es formatter
{
"format_options" : {
"indent": {
"value": "\t",
"MultipleVariableDeclaration": 1,
},
"whiteSpace": {
"after": {
"FunctionReservedWord": 1,
}