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
bind generic f !@git fetch | |
bind generic p !@git pull | |
bind generic P !@git push | |
bind generic { !?git push -f | |
bind generic r !git rebase -i master | |
bind generic U !@git up | |
bind generic M !@git checkout master | |
bind generic ! !@git reset HEAD^ | |
bind generic @ !@?git reset --hard HEAD^ | |
bind generic a !git commit --amend |
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
# ob - a chainable object helper | |
# | |
# ob({foo:1, bar: 2, zap: undefined}) | |
# .compact() | |
# .map((v) -> v + 1) | |
# .value | |
# | |
# // {foo:2, bar: 3} | |
ob = (obj) -> |
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
# directive to cause elements to have equal heights | |
# caveat -- they must share the same parent which contains this | |
# directive and an attribute of matchHeightOf = ".selector" | |
app.directive 'cssEqualHeight', ($window, $timeout) -> | |
restrict: 'A' | |
compile: (el, attrs) -> | |
$matchables = angular.element(el).find(attrs.matchHeightOf) | |
@matchHeights = makeHeightMatcher $matchables | |
angular.element($window).on 'resize', -> |
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
### | |
Logging, local variables, and a dash of opinion. | |
This gist intends to explore the impact of logging in software development. Briefly I should give | |
a bit of background: I'm not a fan of logging frameworks. The original intent of this article was | |
to present an argument against logging by examining: | |
1. How logging introduces state | |
2. Why local variables are bad | |
3. Proof that local variables are worse than logging |
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
# remove the heads off arrays of base_64 encoded datauris | |
# | |
# in this example we take the array of images encoded from | |
# whammy.js and return an array without the heads. This is | |
# an admittedly vain optimization but, every byte counts. | |
Base64Header = (type) -> | |
head: "data:#{type};base64," | |
add: (string) -> | |
"#{HEAD}#{string}" |
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
app = express() | |
server = http.createServer app | |
io = require('socket.io').listen(server) | |
server.listen process.env.PORT |
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
bind generic f !@git fetch | |
bind generic p !@git pull | |
bind generic P !@git push | |
bind generic { !?git push -f | |
bind generic r !git rebase -i master | |
bind generic U !@sh -c "git checkout master && git pull && git checkout - && git rebase master" | |
bind generic M !@git checkout master | |
bind generic ! !@git reset HEAD^ | |
bind generic @ !@?git reset --hard HEAD^ | |
bind generic a !git commit --amend |
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
# takes an object of methods and makes them optionally chainable, | |
# all lodash methods are accessible in the chain too | |
# | |
# The following methods are added as well: | |
# attr: returns value of attribute on given object | |
# inlcuding: extends either object, or each object in collection | |
# with attrName: callback(object) | |
# if no callback is given then attrName is assumed to be a function | |
# passed to _.chainable: attrName: attrName(object) | |
# |
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
store = { | |
get: function(path) { return JSON.parse(localStorage.getItem(path)); }, | |
set: function(path, item) { | |
localStorage.setItem(path, JSON.stringify(item)); | |
return item; | |
} | |
} |
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
#without clone | |
car = type: 'buick' | |
newCar = car | |
newCar.type = 'honda' | |
car.type #honda | |
newCar.type #honda |
OlderNewer