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
module ActiveScaffoldStateMachine | |
# add to controller | |
#config.action_links.member.add 'get_states', position: false | |
=begin | |
Then create a view called get_states.js.erb and put it in the view dir or | |
a common directory called active_scaffold_overrides which contains the following: | |
<% |
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 :database_utilities do | |
desc "Recreate a sqlite3 dev db from current pg_dump from production." | |
# This task should only ever be run in a development environment. | |
task create_sqlite3_from_pg_dump: :environment do | |
# by Mark on Wed May 13 06:15:09 EDT 2015 | |
# Based on the ideals from this webpage: | |
# http://manuel.manuelles.nl/blog/2012/01/18/convert-postgresql-to-sqlite/ |
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
require 'rubygems' | |
require 'irb/completion' | |
require 'map_by_method' | |
require 'what_methods' | |
require 'pp' | |
require 'hirb' | |
require 'irb/completion' | |
require 'irb/ext/save-history' | |
# Tell irb how much it should remember and where |
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
require 'rubygems' | |
gem 'scrapi' | |
require 'scrapi' | |
# Parse bens bargains! | |
URL = 'http://bensbargains.net/' | |
scraper = Scraper.define do | |
array :posts | |
process '.newsText', :posts => Scraper.define { |
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
export PS1="\[\033[01;34m\] \w \[\033[31m\]\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`\[\ 033[37m\]$\[\033[00m\] " |
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("gems:install", :sudo => true) | |
gem 'install_theme' | |
#gem 'haml' | |
#run 'haml --rails .' | |
gem 'mislav-will_paginate', :lib => 'will_paginate' | |
#gem 'rubyist-aasm' | |
plugin 'resource_controller', |
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
############## plugin commands ################# | |
# RSpec is the original Behaviour Driven Development framework for Ruby. | |
plugin 'rspec', | |
:git => "git://github.com/dchelimsky/rspec.git" | |
# The world's greatest templating system | |
plugin 'haml', | |
:git => "git://github.com/nex3/haml.git" |
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
module ApplicationHelper | |
def link_to_remove_fields(name, f) | |
f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)") | |
end | |
def link_to_add_fields(name, f, association) | |
new_object = f.object.class.reflect_on_association(association).klass.new | |
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| | |
render(association.to_s.singularize + "_fields", :f => builder) | |
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
# polyline_decoder.rb by George Lantz August 2007 | |
# Usage Example: | |
# | |
# line = "{b~zEdruxPT?L|@PP" |
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
#-- | |
# | |
# Utility for creating Google Maps Encoded GPolylines | |
# | |
# License: You may distribute this code under the same terms as Ruby itself | |
# | |
# Author: Joel Rosenberg | |
# | |
# ( Drawing from the official example pages as well as Mark McClure's work ) | |
# |
OlderNewer