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
# drop into "initializers" dir | |
heroku = !!ENV['HEROKU_TYPE'] | |
css_dir = heroku ? 'tmp' : 'public' | |
location = Rails.root + 'app/styles' | |
unless Sass::Plugin.template_location_array.any? { |pair| pair.first.to_s == location.to_s } | |
Sass::Plugin.add_template_location(location, Rails.root + css_dir + 'stylesheets') | |
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
shell /bin/bash | |
#term xterm-256color | |
term xterm | |
# terminfo and termcap for nice 256 color terminal | |
# # allow bold colors - necessary for some reason | |
attrcolor b ".I" | |
# # tell screen how to set colors. AB = background, AF=foreground | |
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' | |
defbce "on" |
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
# support for using named routes from the console | |
# | |
# files: lib/railsext.rb | |
# | |
module Kernel | |
private | |
def use_named_routes_in_the_console! options = {} | |
include ActionController::UrlWriter | |
options.to_options! |
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
# ============================================================================ | |
# Info class | |
# ============================================================================ | |
class ApplicationInfo < Rails::Generators::AppGenerator | |
attr_reader :notices, :errors, :options, :data | |
def initialize | |
@notices = [] # Array of notices to display to the user at the end | |
@errors = [] # Array of errors to display to the user at the end | |
@options = [] # Array of options selected throughout the template |
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
#! /usr/bin/env ruby | |
Main { | |
name 'gist' | |
description <<-__ | |
command line script for writing and reading to http://gist.github.com/ | |
__ | |
examples <<-__ |
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_eval(<<-__, __FILE__, __LINE__ - 1) | |
def #{ mode }(*args, &block) | |
if args.empty? | |
mode(#{ mode.inspect }, &block) | |
else | |
mode(#{ mode.inspect }) do | |
call(*args, &block) | |
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
# a little rake task to rename a Rails3 project. handles editing files, | |
# renaming files, and renaming directories. use NOOP=true to view | |
# edits/renames before performing them. | |
# | |
begin | |
### gem install map | |
# | |
### gem 'map' | |
# |
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
Tree = {function,1,foo,1, | |
[{clause,1, | |
[{var,1,self}], | |
[], | |
[{op,1,'+',{integer,1,1},{integer,1,2}}]}]}. | |
% Thanks to N_Ox on #erlang for pointing erl_syntax:abstract out. | |
{value, Tree, _ } = erl_eval:expr(erl_syntax:revert(erl_syntax:abstract(Tree), [])). |
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
# instead of setting all paths individually, you set all of them relative to | |
# another root, say my_gem/lib/rails/engine this way | |
if defined?(Rails) | |
module MyGem | |
class Engine < Rails::Engine | |
paths.path = MyGem.engine_dir |
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.rubyforge_project = 'codeforpeople' | |
This.author = "Ara T. Howard" | |
This.email = "[email protected]" | |
This.homepage = "http://github.com/ahoward/#{ This.lib }" | |
task :default do | |
puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort) | |
end |
OlderNewer