Skip to content

Instantly share code, notes, and snippets.

@nerdEd
nerdEd / pivot-own.rb
Created Apr 28, 2011
Change 'requested by' value for all stories in a project
View pivot-own.rb
require 'pivotal-tracker'
PivotalTracker::Client.token = 'lkjlkjlkj'
proj = PivotalTracker::Project.find(297071)
proj.stories.all.each do |story|
if story.requested_by == 'Ex Employee'
story.update({:requested_by => 'Current Employee'})
end
end
View Haml Filter
module Haml::Filters::RubyCode
include Haml::Filters::Base
def render(text)
"<div class='ruby'>#{text}</div>"
end
end
View iterm_pastel_theme.sh
#!/bin/bash
PASTEL='{
"Ansi 0 Color" = {
"Blue Component" = 0.3097887;
"Green Component" = 0.3097887;
"Red Component" = 0.3097887;
};
"Ansi 1 Color" = {
"Blue Component" = 0.3764706;
View WhackCurrentTrack.scpt
(*
MODIFIED VERSION OF THIS SCRIPT TO REMOVE CONFIRMATIONS
Original Script: http://dougscripts.com/itunes/scripts/ss.php?sp=whackcurrenttrack
"Whack Current Track" for iTunes
written by Doug Adams
dougadams@mac.com
View SQL_COMPLEXITY_FAIL.sh
MBP:~ ed$ ruby -e 'while line = gets; puts line.split; end' <~/Desktop/generated_query.sql | grep JOIN | wc -l
15
View dr-pepper-barbecue-sauce.txt
1 tbsp olive oil 15 mL
1 small onion
3 cloves garlic, minced
1 tsp chili powder 5 mL
1 tsp ground cumin 5 mL
1 1/3 cups ketchup 325 mL
2/3 cup dr. pepper 150 mL
1/4 cup soy sauce 60 mL
1/4 cup cider vinegar 60 mL
1 drop liquid smoke
View gist:378684
runtime! autoload/pathogen.vim
if exists('g:loaded_pathogen')
call pathogen#runtime_prepend_subdirectories(expand('~/.vimbundles'))
end
colorscheme native
set tabstop=2
set smarttab
View gist:377398
def login
twitter_client = TwitterOAuth::Client.new(:consumer_key => TWITTER_CONSUMER_KEY, :consumer_secret => TWITTER_CONSUMER_SECRET)
if !returning_from_twitter?
request_token = twitter_client.request_token(:oauth_callback => url_for(:login))
session[:request_token] = request_token.token
session[:request_token_secret] = request_token.secret
redirect_to request_token.authorize_url
else
twitter_client.authorize(
View gist:376714
# Is this good? Like on a scale of 1 - 10, 1 being, "oh god my eyes the burning I can't even"
# and 10 being, "DO IT MOAR!"
class Document
attr_accessor :foo, :bar
def initialize
if block_given?
yield self
end
View rgb_hex_to_uicolor.rb
def convert(str)
x = str.to_i(base=16)
x/255.0
end
hex_value = ARGV[0].strip
alpha = ARGV[1] || 1.0
red, green, blue = convert(hex_value[0,2]), convert(hex_value[2,2]), convert(hex_value[3,2])