This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb" | |
require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb" | |
result = TextMate::UI.request_string( | |
:title => 'Open Rubygem', | |
:prompt => 'Name of the gem to open', | |
:default => ENV['TM_CURRENT_WORD'] || "", | |
:button1 => 'Open' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this method the MyApp::Application class (in config/application.rb) | |
def load_console(sandbox=false) | |
super | |
project_specific_irbrc = File.join(Rails.root, ".irbrc") | |
puts "Loading project specific .irbrc ..." | |
load(project_specific_irbrc) if File.exists?(project_specific_irbrc) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HouseDetail | |
def foo | |
return [1,2,3] | |
end | |
end | |
class KeyInvoker | |
instance_methods.reject {|meth| meth.to_s =~ /^_/ }.each { |meth| undef_method(meth.to_sym) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
acf, x = [], [] | |
time_val = 0.002 | |
i = time_val | |
# init function 'x[i] = A0 * cos(2*pi*f*i); f = 100Hz' | |
freq = 100.0 # Hz | |
sample_window = (freq/time_val).to_i+1 | |
(freq*2/time_val).to_i.times do | |
# puts "#{i}: #{2.0*Math::PI*f*i}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
bindkey -e '^[[3~' delete-char | |
# bindkey -v "^[Od" backward-word | |
# bindkey -v "^[Oc" forward-word | |
bindkey -e "^A" beginning-of-line | |
bindkey -e "^E" end-of-line | |
bindkey -e "^K" kill-line | |
bindkey -e "^L" clear-screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'rubygems' | |
require 'rb-fsevent' | |
command = ARGV[0] | |
fsevent = FSEvent.new | |
fsevent.watch Dir.pwd do |directories| | |
system command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run->(e){`curl twitter.com#{e['PATH_INFO']}`=~/_(\d+)"/;[200,{'Content-Type'=>''},[$1]]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pbcopy(input) | |
IO.popen("pbcopy", "r+") do |clipboard| | |
clipboard << input | |
end | |
return input | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changes = { | |
"Boooking:234" => lambda { |record| record.some_attribute = "new_value" } | |
} | |
changes.each do |model_class_and_id, change| | |
begin | |
klass = model_class_and_id.split(":").first.constantize | |
id = model_class_and_id.split(":").last.to_i | |
print "== Changing #{klass} '#{id}' ... " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV["RAILS_ENV"] ||= 'test' | |
if defined?(Bundler) | |
Bundler.setup(*%w(development test)) | |
end | |
require 'rspec' | |
require 'renum' | |
require 'active_model' |
OlderNewer