Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am eethann on github.
  • I am colab_ethan (https://keybase.io/colab_ethan) on keybase.
  • I have a public key ASA2omRGFENL37kJnnEQcn4isnlUoVcm3vb-AduORQ9BeAo

To claim this, I am signing this object:

@eethann
eethann / dotask.sh
Last active January 22, 2019 12:13 — forked from fmartingr/dotask.sh
Add check for empty ID, to avoid unhandled error where no ID specified
#!/bin/bash
TMPFILE='/tmp/rofi-dmenu-taskwarrior'
task rofi rc.verbose=nothing > $TMPFILE
TASK=`rofi -dmenu -p "Task: " -i -input $TMPFILE`
TASK_ID=`echo $TASK | cut -f1 -d' '`
;; # Explorations for notating note sequences through numbers in different bases.
;;
;; This sketch explores an API to represent a note via a number of a fixed
;; number of digits in the base of the number of notes in the mode.
;;
;; Examples: 7r030 for C3, 7r072 for E7 (if major mode)
;;
;; This approach has the benefit of equivalence between addition and transposition:
;;
;; `(+ 7r013 7r010) => 7r023` and `(+ 7r011 7r006) => 7r020`
@eethann
eethann / _.objMapFunctions.js
Created August 23, 2012 01:05
Underscore mixin with common iterator functions adapted to work with objects and maintain key/val pairs.
_.mixin({
// ### _.objMap
// _.map for objects, keeps key/value associations
objMap: function (input, mapper, context) {
return _.reduce(input, function (obj, v, k) {
obj[k] = mapper.call(context, v, k, input);
return obj;
}, {}, context);
},
// ### _.objFilter
@eethann
eethann / .vimrc-statusline.vim
Created December 15, 2011 17:14
vimrc segment for syntastic- and fugitive-enabled statusline.
" from https://github.com/spf13/spf13-vim/blob/master/.vimrc
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=\ [%{getcwd()}] " current dir
set statusline+=%#warningmsg#
###
# Below is a quick example of how CoffeeScript can be used to easily template JSON
#
# CoffeeScript has a few notable features for this role:
#
# 1. It has existential accessors, so you safely invoke nested properties w/o checking for their existence explicitly (`myObj.someOptionalProp?.someOtherOptProp?.val)
# 2. Using the "do" constrution you can execute anonymous functions that return objects in place, allowing fairly straightforward conditional json properties and other pre-processing.
# 3. Using multi-line object definitions and the underscore extend method, it's fairly literate to intermingle code with basic json values.
# 4. It's object notation is nice.
###
#!/bin/bash
# Adapted PHP CodeSniffer pre-commit hook for git
#
# @author Ethan Winn <ethan@colab.coop>
# @author Soenke Ruempler <soenke@ruempler.eu>
# @author Sebastian Kaspari <s.kaspari@googlemail.com>
#
# See the original project README:
# https://github.com/s0enke/git-hooks/tree/master/phpcs-pre-commit
@eethann
eethann / branch.js
Created October 14, 2012 19:46
Mongoose Tree Schema
// An excerpt from a Mongoose model.js file for use with Express:
// Sub-document to store parent ref along with it's value (a form of caching)
var Parent = new Schema({
id: ObjectId
, text: String
});
// Main tree-node element schema
var Branch = new Schema({
@eethann
eethann / Vagrantfile
Created October 29, 2012 15:02
Vagrant/Knife issue background materials
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "MyCentOS_base"
@eethann
eethann / eethann-mixins.scss
Created September 13, 2012 14:52
Sass Mixins
/* mixin for background images */
/* from http://remy.bach.me.uk/2011/09/compass-background-image-mixin/ */
/* may also use compass `replace-text-with-dimensions` */
@mixin knockout($_img) {
background:url($_img) no-repeat;
display:block;
height:image-height($_img);
overflow:hidden;
text-indent:-100%;
width:image-width($_img);