Skip to content

Instantly share code, notes, and snippets.

View inkdeep's full-sized avatar

Jeremy Kleindl inkdeep

View GitHub Profile
@inkdeep
inkdeep / method_finder.rb
Created July 29, 2011 20:48
original method_finder inspired by _why
# Some credits:
# Code this verions is based on: Andrew Birkett
# http://www.nobugs.org/developer/ruby/method_finder.html
# Improvements from _why's blog entry
# * what? == - _why
# * @@blacklist - llasram
# * $stdout redirect - _why
# http://redhanded.hobix.com/inspect/stickItInYourIrbrcMethodfinder.html
# Improvements from Nikolas Coukouma
# * Varargs and block support
namespace :test do
task :populate_testopts do
if ENV['TESTNAME'].present?
ENV['TESTOPTS'] = ENV['TESTOPTS'] ? "#{ENV['TESTOPTS']} " : ''
ENV['TESTOPTS'] += "--name=#{ENV['TESTNAME'].inspect}"
end
end
end
%w(test:units test:functionals test:integration).each do |task_name|
@inkdeep
inkdeep / annoying.js
Created June 1, 2011 17:25 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
@inkdeep
inkdeep / update_github_tmbundles.rb
Created April 7, 2011 17:44
Update TextMate bundles cloned from GitHub (or wherever) in ~/Library/Application Support/TextMate/Bundles
#!/usr/bin/env ruby
textmate_bundle_path = File.expand_path('~/Library/Application Support/TextMate/Bundles/')
Dir.chdir(textmate_bundle_path)
bundles = Dir.glob('*.tmbundle')
bundles.each do |bundle|
Dir.chdir(File.join(textmate_bundle_path, bundle))
puts %(
# Capistrano recipe to tail log files on remote servers and open them in Textmate
namespace :log do
namespace :mate do
unset :_log
%w(access error production).each do |file|
desc "View #{file}.log from remote server in Textmate."
task file.to_sym, :roles => :app do
set :_log, file
@inkdeep
inkdeep / _pm_irbrc.rb
Created August 14, 2010 19:49
Useful method to print an objects methods in an irb/console session.
# pm - Print methods of objects in irb/console sessions.
# Goes in ~./irbrc
#
begin # Utility methods
def pm(obj, *options) # Print methods
methods = obj.methods
methods -= Object.methods unless options.include? :more
filter = options.select {|opt| opt.kind_of? Regexp}.first
methods = methods.select {|name| name =~ filter} if filter
// Finds the longest common starting substring in an array of strings
function common_substring(data) {
var i, ch, memo, idx = 0
do {
memo = null
for (i=0; i < data.length; i++) {
ch = data[i].charAt(idx)
if (!ch) break
if (!memo) memo = ch
else if (ch != memo) break
TVEL - TOM'S VISCIOUSLY EVIL LICENSE
Version 2, June 2000
Copyright (C) 2000 Tom Gilbert.
Everyone is permitted to copy and distribute verbatim copies of
this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
@inkdeep
inkdeep / ptstories.rb
Created November 24, 2009 21:21
Ruby shell script to get 'My Stories' from PivotalTracker and format them for github to pivotal api friendliness
#!/usr/bin/env ruby
require 'rubygems'
require 'highline'
require 'xmlsimple'
require 'uri'
# Retrieves stories a user owns from PivotalTracker API
# Formats the name and story number for pivotial friendly commit messages.
#
# Add this to .bash_profile or .bashrc and replace the values with your information:
#!/usr/bin/env ruby
require 'rubygems'
require 'highline'
require 'xmlsimple'
# Retrieves stories a user owns from PivotalTracker API
# Formats the name and story number for pivotial friendly commit messages.
#
# Add this to .bash_profile or .bashrc and replace the values with your information:
# ## pivotal tracker API call variables