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 | |
# this tool is similar to "git bisect" one, but for specs. | |
# it tries to find what spec from list of specs breaks execution of one specified spec. | |
# | |
# see more at http://zed.0xff.me/2010/01/28/rspec-bisect | |
# | |
# usage example: | |
# ./rspec-bisect.rb spec/**/*_spec.rb spec/controllers/spaces/tickets_controller_spec.rb | |
# [.] rspec runner: ./script/spec |
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
rendering a custom plugin | |
<% content_for :page_title do %> | |
<%= @destination.title %> | |
<% end %> | |
<% content_for :page_body do %> | |
<section> | |
<h1>Choose from our most popular recommended itineraries below</h1> | |
</section> |
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
Original code from: | |
http://www.wezm.net/technical/2009/05/exclude-directories-from-textmate-side-bar-for-faster-find-in-project/ |
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
$ rake translate:lost_in_translation_all | |
Searching for missing translations for the locale: en | |
No missing translations for locale: en | |
-- | |
Searching for missing translations for the locale: fr | |
No missing translations for locale: fr | |
-- | |
Searching for missing translations for the locale: nl | |
No missing translations for locale: nl |
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
# Find files recursively in/under the current directory | |
function findin() | |
{ | |
find . -exec grep $@ '{}' \; -print | |
} | |
# Rails 2 and Rails 3 console | |
function rc { | |
if [ -e "./script/console" ]; then | |
./script/console $@ | |
else |
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 | |
# | |
# A quick script to dump an overview of all the open issues in all my github projects | |
# | |
require 'octokit' | |
require 'awesome_print' | |
require 'rainbow' |
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
ruby-1.9.2-p0 > p=Page.last | |
Page Load (0.3ms) SELECT "pages".* FROM "pages" ORDER BY pages.id DESC LIMIT 1 | |
=> #<Page id: 3, parent_id: nil, position: 1, path: nil, created_at: "2011-05-11 02:44:43", updated_at: "2011-05-11 02:44:43", show_in_menu: true, link_url: nil, menu_match: nil, deletable: true, custom_title_type: "none", draft: false, skip_to_first_child: false, lft: 5, rgt: 6, depth: nil> | |
ruby-1.9.2-p0 > p.read_attribute(:path) | |
=> nil | |
ruby-1.9.2-p0 > p.read_attribute(:position) | |
=> 1 | |
ruby-1.9.2-p0 > p.attribute_names | |
=> ["title", "custom_title", "meta_keywords", "meta_description", "browser_title", "id", "parent_id", "position", "path", "created_at", "updated_at", "show_in_menu", "link_url", "menu_match", "deletable", "custom_title_type", "draft", "skip_to_first_child", "lft", "rgt", "depth"] | |
ruby-1.9.2-p0 > p.attributes |
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 capture_stdout(stdin_str = '') | |
begin | |
require 'stringio' | |
$o_stdin, $o_stdout, $o_stderr = $stdin, $stdout, $stderr | |
$stdin, $stdout, $stderr = StringIO.new(stdin_str), StringIO.new, StringIO.new | |
yield | |
{:stdout => $stdout.string, :stderr => $stderr.string} | |
ensure | |
$stdin, $stdout, $stderr = $o_stdin, $o_stdout, $o_stderr | |
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
location / { | |
try_files /system/maintenance.html $uri $uri/index.html $uri.html @passenger; | |
expires 60s; | |
add_header Cache-Control public; | |
add_header Vary Accept-Encoding; | |
} |
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
# This will help you trace .yml file which containts Psych::SyntaxError | |
require "rubygems" | |
require "psych" | |
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |
# specify your locales folder in Dir.glob("*") with relative path from this file | |
Dir.glob("*").sort.each do |file| | |
begin |
OlderNewer