Skip to content

Instantly share code, notes, and snippets.

View KamilSzot's full-sized avatar

Kamil Szot KamilSzot

  • :.
  • Poland / Łódź
View GitHub Profile
$ 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
@KamilSzot
KamilSzot / gist:f326d4593d14d12cd5a9
Last active August 29, 2015 14:00
JavaScript 1.7 mouse drag state machine using generators as coroutines.
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'
});
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 {