Skip to content

Instantly share code, notes, and snippets.

View levicole's full-sized avatar

Levi Cole levicole

  • Kolide
  • Nashville, TN
View GitHub Profile
#!bash
#
# git-flow-completion
# ===================
#
# Bash completion support for [git-flow](http://github.com/nvie/gitflow)
#
# The contained completion routines provide support for completing:
#
# * git-flow init and version
@levicole
levicole / localize.vim
Created April 26, 2011 20:52
I18n helper for vim
"takes whatever you have highlighted in visual mode, you give it a localization key, it inserts that and puts the key plus the phrase in a register for yanking into your locale file.
function! Rlocalize(lk) range
let saved_reg_type = getregtype('"')
let old_reg = getreg('"')
normal! ""gvy
let selection = getreg('"')
let key = split(a:lk, '\.')
let phrase = key[-1].": \"".selection."\""
call setreg('l', phrase, "l")
@levicole
levicole / gist:924494
Created April 17, 2011 21:27
simple clearing fields jquery plugin
(function($){
$.fn.clearingField = function(){
return this.each(function(){
var obj = $(this);
var hint = obj.val();
obj.focus(function(){
if(obj.val() == hint){
obj.val("");
}
@levicole
levicole / artist_id3_updater.rb
Created March 18, 2011 00:20
update mp3 artist ID3 tag
require 'rubygems'
require 'id3lib'
Dir.glob("./*.mp3").each do |mp3|
puts "updating #{mp3}"
tag = ID3Lib::Tag.new(mp3)
tag.artist = "artist name"
if tag.update!
puts "#{mp3} updated!"
else
Then /^I should see element "([^"]*)" before element "([^"]*)"$/ do |first, second|
xpath = "//*[@id='#{first}']/following-sibling::*[@id='#{second}']"
response_body.should have_xpath(xpath)
end
@levicole
levicole / gist:745014
Created December 17, 2010 14:28
compass/sass setup for heroku
#config.ru
use Rack::Static, :urls => ["/stylesheets"], :root => "tmp"
# config/compass.rb
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "tmp/stylesheets"
--type-add
ruby=haml,sass,builder,rake
function Bullet() {
this.x = null;
this.y = spaceship.y - 5;
this.speed = 4;
this.length = 8;
this.prototype.draw = function(){
ctx.beginPath();
ctx.moveTo(this.x, this.y);
ctx.lineTo(this.x, this.y + this.length);
ctx.stroke();
function clearCanvas() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
}
Given /^I am on the "([^"]*)" item page$/ do |arg1|
@item = Factory(:item, :name => arg1)
visit item_path(@item)
end
Then /^I see the add to cart button$/ do
page.should have_css("button", :text => "Add to cart")
end
When /^I click the "([^"]*)" button$/ do |arg1|