Skip to content

Instantly share code, notes, and snippets.

View levicole's full-sized avatar

Levi Cole levicole

  • Kolide
  • Nashville, TN
View GitHub Profile
tempo 120
instrument bass
type square
punch 0.441
sustain 0.067
decay 0.197
freq 0.499
phrase 1
require 'rubygems'
require 'bundler'
Bundler.require
require './app'
require 'sass/plugin/rack'
root = ::File.dirname(__FILE__)
require './app'
# Configuration to use when running within Sinatra
project_path = Sinatra::Application.root
# HTTP paths
http_path = '/'
http_stylesheets_path = '/stylesheets'
http_images_path = '/images'
http_javascripts_path = '/javascripts'
(function($){
$.fn.attrs = function(attrs){
var $this = $(this);
return $.map($.makeArray(attrs), function(attr){
return $this.attr(attr)
})
}
})(jQuery)
@levicole
levicole / README.md
Created July 20, 2011 00:32
Terminal Admin

TerminalAdmin

Slightly inspired by the interactive_editor gem, this allows you to edit mongoid documents as yaml in vim. Once the file is written, the changes are applied to that object. If you tack on the bang, then the changes are automatically persisted to the database.

example:

# vim:set ft=sh sw=2 sts=2:
# My own version of a little todo script. Basically just grabs a file in the
# $TODOS_DIR Right now, my $TODOS_DIR is set in my .bashrc
todo(){
cd $TODOS_DIR
vim $1
}
class Grid
constructor: (@heightInCells, @widthInCells, @cellSize, canvas) ->
@canvas = canvas
@canvas.width = @widthInCells * @cellSize
@canvas.height = @heightInCells * @cellSize
@ctx = @canvas.getContext("2d")
@cells = @initializeCells()
initializeCells: ->
rows = (((new Cell(x,y,'dead',@)) for x in [0..(@widthInCells-1)]) for y in [0..(@heightInCells-1)])
require 'rubygems'
class Cell
attr_accessor :n, :s, :e, :w, :visited
def initialize(n, s, e, w, visited)
@n, @s, @e, @w, @visited = n, s, e, w, visited
end
def []=(key, value)
self.send("#{key.to_s}=", value)
end
it 'can apply the canvas to the DOM', ->
(setFixtures sandbox())
@canvas.write('#sandbox')
(expect document.getElementById("sandbox")).toContain('canvas')
autocmd User Rails Rnavcommand sass app/stylesheets -glob=**/* -suffix=.sass
autocmd User Rails Rnavcommand feature features -suffix=.feature
autocmd User Rails Rnavcommand fabricator spec/fabricators -suffix=_fabricator.rb
let g:surround_{char2nr("l")} = "link_to \1text: \1, \2path:\2\r"
let g:surround_{char2nr("#")} = "#{\r}"