View chai plugin to check if object tree contains some subtree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chai.use(function(chai, utils) { | |
function containsProperties(expected) { | |
var actual = this._obj; | |
var success = true; | |
if(!utils.flag(this, 'deep')) { | |
if(Array.isArray(expected)) { | |
this.assert(success = expected.subtract(Object.extended(actual).select(expected).keys()).length === 0, "expected "+JSON.stringify(actual)+" to have "+JSON.stringify(expected)); | |
} else { |
View gist:f326d4593d14d12cd5a9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $box = $('<div id="box">').appendTo(document.body).css({ | |
width: 100, | |
height: 100, | |
position: 'absolute', | |
left: 100, | |
top: 100, | |
background: 'green', | |
cursor: 'pointer', | |
border: '5px solid red' | |
}); |
View gist:11290301
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat .git/hooks/pre-commit | |
#!/bin/bash | |
root_dir=`git rev-parse --show-toplevel` | |
for new_file in `git status --porcelain | awk '/\?\?/ { print $2 }'`; | |
do |