Skip to content

Instantly share code, notes, and snippets.

View aesnyder's full-sized avatar

Aaron Snyder aesnyder

View GitHub Profile
#!/bin/bash
BRANCH=`git rev-parse --abbrev-ref HEAD`
echo Pushing $BRANCH to origin/$BRANCH and and origin/gh-pages
git push origin $BRANCH
git push origin $BRANCH:gh-pages
echo Pushed $BRANCH to origin/$BRANCH and and origin/gh-pages
@aesnyder
aesnyder / app.coffee
Created April 4, 2013 19:15
node streaming instagram
express = require('express')
app = express()
Instagram = require('instagram-node-lib')
Instagram.set 'client_id', '110a0f5f4aae44c58aa75dadc340f9ac'
Instagram.set 'client_secret', 'd198ac94655a4670bb3dedd0f220caab'
Instagram.set('callback_url', 'http://5aqc.localtunnel.com')
Instagram.tags.info
.timer
.timer-progress
h2.question_body= body
.grey-holder
.red.rgb-block(data-color="red")
.fill
.green.rgb-block(data-color="green")
.fill
.blue.rgb-block(data-color="blue")
.fill
@aesnyder
aesnyder / .tigrc
Created February 7, 2014 14:45
Mojo .Tigrc
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
@aesnyder
aesnyder / gist:9403886
Last active August 29, 2015 13:57
Functional Chaining in CoffeeScript and Underscore.js
# ob - a chainable object helper
#
# ob({foo:1, bar: 2, zap: undefined})
# .compact()
# .map((v) -> v + 1)
# .value
#
# // {foo:2, bar: 3}
ob = (obj) ->
@aesnyder
aesnyder / gist:9764109
Created March 25, 2014 15:23
Postrender test case.
# 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', ->
@aesnyder
aesnyder / gist:9770794
Last active August 29, 2015 13:57
Logging, local variables, and a dash of opinion.
###
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
@aesnyder
aesnyder / Kompressor.coffee
Created March 27, 2014 14:18
Remove base64 heads from array - whammy.js
# 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}"
app = express()
server = http.createServer app
io = require('socket.io').listen(server)
server.listen process.env.PORT
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