-
Filename correction during completion
-
if dir1/x exists and dir2 exists, then "dir/x<TAB>" completes to dir1/x
-
if name1 is a file and name2 is a directory with files in it, "name/<TAB>" completes to "name2/"
-
Better ctrl-R behaviour
-
alerts you if your ctrl-R is failing
-
completes it right on the prompt line while showing you what you're searching for below
This file contains hidden or 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
<div id="instantquoter" class="reveal-modal"> | |
<script src="http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js"></script> | |
<script> | |
$(function() { | |
$("ul.tabs").tabs("div.main > div.panes"); | |
}); | |
</script> | |
This file contains hidden or 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
# Use feature, background, and scenario blocks to write acceptance tests in test/unit | |
# which are really just integration tests. include capybara or webrat or something and voila. | |
# test/acceptance_helper.rb | |
require 'test_helper' | |
module ActionDispatch | |
class AcceptanceTest < ActionDispatch::IntegrationTest | |
class << self | |
alias :background :setup |
This file contains hidden or 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
module Yehudalize | |
def method_missing(method_sym, *arguments, &block) | |
if method_sym.to_s =~ /^(?:omg_)?(.*)_to_me$/ | |
send($1.to_sym, *arguments, &block) | |
else | |
super | |
end | |
end | |
end |
This file contains hidden or 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
module Enumerable | |
def map_to_hash(&block) | |
self.inject({}) do |acc,v| | |
acc.merge(block.call(v)) | |
end | |
end | |
end | |
x = [:a, :b, :c].map_to_hash do |v| | |
{v => v.to_s.upcase} |
This file contains hidden or 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
# This isn't necessarily "better", or even "useful" in any way, just sort of fun. | |
class Object | |
# I like how I can actually create methods with these names. | |
def if | |
@__if_result = yield self | |
self | |
end | |
def then | |
@__if_result ? yield self : self |
This file contains hidden or 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
# previously required http://github.com/mislav/addressable | |
# with changes merged upstream, main repo should work too: | |
# http://github.com/sporkmonger/addressable/ | |
require 'addressable/template' | |
# http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses%C2%A0followers | |
template = Addressable::Template.new 'http://{host=twitter.com}' + | |
'/statuses/followers{-prefix|/|id}.{format=json}' + | |
'?{-join|&|user_id,screen_name,cursor}' |
This file contains hidden or 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
require 'rubygems' | |
require 'ghost' | |
module Productivity | |
BLOCK_LIST = %W{ facebook.com twitter.com } | |
def start | |
puts "Blocked:" | |
BLOCK_LIST.each do |host| | |
Host.add(host,'127.0.0.1') |
This file contains hidden or 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
// replaced this | |
$(document).ready(function() { | |
if ($.fn.corner) $('.corner').corner() | |
}) | |
// with this | |
.corner { | |
-moz-border-radius: 8px; | |
-webkit-border-radius: 8px; | |
border-radius: 8px; |
This file contains hidden or 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
# Controller | |
def index | |
@results = SexOffender.all | |
end | |
# View | |
<% if @results.blank? %> | |
<span>no sex offenders were found</span> |