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
" | |
" :help add-plugin | |
" :help add-global-plugin | |
" :help runtimepath | |
" |
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
:help add-plugin | |
" :help add-global-plugin | |
" :help runtimepath |
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
if filereadable(expand("~/.gvimrc.before")) | |
source ~/.gvimrc.before | |
endif | |
" CtrlP OS-X Menu remapping | |
if janus#is_plugin_enabled('ctrlp') && has("gui_macvim") | |
macmenu &File.New\ Tab key=<D-S-t> | |
endif | |
if filereadable(expand("~/.gvimrc.after")) |
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
# When an RSpec test like this fails, | |
# | |
# @my_array.should == [@some_model, @some_model2] | |
# | |
# RSpec will call inspect on each of the objects to "help" you figure out | |
# what went wrong. Well, inspect will usually dump a TON OF SHIT and make trying | |
# to figure out why `@my_array` is not made up of `@some_model` and `@some_model2` | |
# really really painful. | |
# | |
# This little module and technique helps get around that. It will redefine `inspect` |
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
namespace :db do | |
namespace :migrate do | |
desc "stucture" | |
task :structure => [:environment, :load_config] do | |
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true | |
ActiveRecord::Migrator.migrate(['db/migrate/structure'], ENV["VERSION"] ? ENV["VERSION"].to_i : nil) | |
Rake::Task["db:schema:dump"].invoke | |
end | |
# This will run the migrations in db/migrate/data. |
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 Presenter | |
class Base | |
def routes | |
Rails.application.routes.url_helpers | |
end | |
alias :r :routes | |
# Wholesale stole helpers and self.helpers from Draper | |
def helpers |
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
# Builds a link using the route helper below | |
# text - String | |
# route_name - String used to lookup route in the routes global object | |
Handlebars.registerHelper 'link_to', (text, route_name) -> | |
href = Handlebars.helpers['route'](route_name, @) | |
template = _.template("<a href='{{href}}'>{{text}}</a>") | |
template(text: text, href: href) | |
# Returns what it returns. | |
# Grab a named route from the global routes object |
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
if Module.const_defined?('ActionView') | |
include ::ActionView::Helpers::NumberHelper | |
namespace :db do | |
namespace :tables do | |
desc "how big is each table?" | |
task :size => :environment do | |
sql = "SELECT tablename FROM pg_tables WHERE schemaname = 'public' ORDER BY tablename;" | |
tables = ActiveRecord::Base.connection.execute(sql) | |
sizes = [] |
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 rake | |
# Add your own tasks in files placed in lib/tasks ending in .rake, | |
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | |
# If certain tasks are called, don't load Rails! | |
if %w(spork:start spork:restart spork:stop).include?(Rake.application.top_level_tasks.first) | |
# Load the rake tasks | |
Dir.glob("#{File.expand_path("../lib/tasks", __FILE__)}/*.rake").each { |r| import r } | |
else | |
require File.expand_path('../config/application', __FILE__) |
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 file will be compiled into native Javascript. | |
// You can't just use twait natively! | |
// It writes out nasty js, but hey, you didn't have to write the nasty js right? | |
require('tamejs').register(); | |
var dns = require("dns"); | |
function do_one (ev, host) { | |
twait { | |
dns.resolve (host, "A", mkevent (var err, ip)); |