Skip to content

Instantly share code, notes, and snippets.

View aesnyder's full-sized avatar

Aaron Snyder aesnyder

View GitHub Profile
# 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
hey jason!
@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
@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'
app.service 'deferrable', ($q) ->
(fn) ->
d = $q.defer()
fn d
d.promise
@aesnyder
aesnyder / gist:fe0fe90489ee2c377f8d
Created February 24, 2015 19:50
Object by reference javascript coffeescript example
#without clone
car = type: 'buick'
newCar = car
newCar.type = 'honda'
car.type #honda
newCar.type #honda
@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
@aesnyder
aesnyder / local.js
Created July 23, 2014 15:51
localstorage with non-strings
store = {
get: function(path) { return JSON.parse(localStorage.getItem(path)); },
set: function(path, item) {
localStorage.setItem(path, JSON.stringify(item));
return item;
}
}
@aesnyder
aesnyder / chainable.coffee
Last active August 29, 2015 14:01
_.chainable
# 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)
#