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 | |
task :check_for_pending_plugin_migrations do | |
new_migrations = {} | |
Dir["vendor/plugins/**/migrations/*.rb"].each do |migration_file| | |
path_parts = migration_file.split("/") | |
plugin_name = path_parts[path_parts.index("migrations")-1] | |
migration_name = path_parts.last | |
unless File.exist?(File.join("db", "migrate", migration_name)) |
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
<form ...> | |
<input type="checkbox" name="user[email_enabled]"> | |
<input type="radio" name="user[email_settings]" value="pm_daily"> | |
<input type="radio" name="user[email_settings]" value="pm_instant"> | |
... | |
</form> | |
class Controller | |
def update |
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 'net/http' | |
require 'rubygems' | |
require 'json' | |
EMAIL = "[email protected]" | |
PASSWORD = "yourpassword" | |
def get_stikkits(page = 1) | |
response = Net::HTTP.start('api.stikkit.com') { |http| | |
req = Net::HTTP::Get.new("/stikkits.json?page=#{page}") |
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 | |
require 'fileutils' | |
require 'singleton' | |
class Gitster | |
include Singleton | |
def initialize | |
@created_flags = [] |
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
<h2>My recent links about boobs</h2> | |
<ul> | |
{% recent limit 10, tag 'boobs' do |link| %} | |
<li><a href="{{ link.href }}">{{ link.text }}</a></li> | |
{% endrecent %} | |
</ul> |
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
ActionController::Routing::Routes.capture(:my_plugin_or_whatever) do |map| | |
map.resource :plugin_stuff | |
map.connect "/plugin/:blah", :controller => "whatever" | |
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
# Some bloggish site that has a default route to display pages at | |
# SEO-friendly URLs, like /here-is-my-new-blog-post | |
ActionController::Routing::Routes.draw do |map| | |
map.resources :sections | |
# because this route matches everything, the plugin routes will never be hit. | |
map.connect "/:name", :controller => "pages", :action => "show" | |
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
# Boom | |
Factory.define(:product) do |product| | |
product.handles do |p| # or whatever the has_many is called | |
Array.new(5) { x.association(:handle) } # return an array, as many as you like. | |
end | |
# etc | |
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
context "A user posting to a blog" do | |
setup do | |
@user = Factory(:user) | |
@blog = Factory(:blog) | |
end | |
action do | |
post :create, :user_id => @user.id, :id => @blog.id, :post => {:body => "Blah"} | |
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
➜ rip (file_conflicts)⚡ $ rm -fr /Users/james/.rip/rip-packages/*; rip use empty; rip env delete test; rip env create test; rip install monk | |
ripenv: using empty | |
ripenv: deleted test | |
ripenv: created test | |
Fetching monk via Rubygems... | |
Fetching thor (~> 0.11) via Rubygems... | |
Successfully installed thor (0.11.5) | |
Fetching dependencies (>= 0.0.6) via Rubygems... | |
Fetching wycats-thor (~> 0.11) via Rubygems... | |
rip: install failed |
OlderNewer