Skip to content

Instantly share code, notes, and snippets.

View aesnyder's full-sized avatar

Aaron Snyder aesnyder

View GitHub Profile
@aesnyder
aesnyder / random-weighted.coffee
Last active October 22, 2017 16:55
Weighted random value in underscore or lodash
## First you can generate a weighted array
weighted 1: true, 2: false # [true, false, false]
weighted 1: true, 3: false # [true, false, false, false]
## Then random picks one randomly
## The following will return true or false with a 1:3 ratio
random weighted 1: true, 3: false
# vim:ft=zsh ts=2 sw=2 sts=2
#
# snyder.zsh-theme
# a simplified agnoster theme with directory in right prompt
#
#
# based off of agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
set nocompatible " be iMproved
set shell=/bin/zsh
set backspace=indent,eol,start
set t_Co=256
set list
set listchars=tab:>-,trail:.,nbsp:.
set hidden
set history=100 " default history is only 20
set undolevels=100 " use more levels of undo
set undofile " save undo's after file closes
@aesnyder
aesnyder / global-utc-angular.coffee
Last active September 8, 2016 16:37
Globally Configure Angular Date $filter to UTC
app.config ($provide) ->
$provide.decorator 'dateFilter', ($delegate) ->
(date, format, timezone) ->
$delegate.call this, date, format, if timezone then timezone else 'UTC'
hey jason!
.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 / 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
#!/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 / vim-airline-circle-ci-status
Created June 30, 2015 22:42
Circle CI status in vim-airline
let g:circle_last_update = localtime()
let g:circle_update_frequencey_in_seconds = 30
function! UpdateCirlceStatus()
let output = system('circle status')
if v:shell_error
let g:circle_last_status = 'fail'
else
let g:circle_last_status = 'pass'
endif
app.service 'deferrable', ($q) ->
(fn) ->
d = $q.defer()
fn d
d.promise