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
| include Workflow | |
| workflow do | |
| state :in_progress do | |
| event :publish, transitions_to: :awaiting_review | |
| end | |
| state :awaiting_review do | |
| event :sent, transitions_to: :being_reviewed | |
| 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
| class CategoriesGenerator | |
| def initialize(document, options = {}) | |
| @document = document | |
| @master_categories = options[:master_categories] || MasterCategory.all | |
| end | |
| def generate! | |
| @master_categories.each do |master_category| |
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
| class Category < ActiveRecord::Base | |
| belongs_to :document | |
| belongs_to :master_category | |
| has_many :pages | |
| def generate_pages! | |
| if pages.empty? | |
| master_category.master_pages.each do |master_page| | |
| pages.create!(master_page.page_attributes) |
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
| class Admin::StepsController < AdminController | |
| include ::Wicked::Wizard | |
| steps :categories, :pages | |
| expose(:magnet_app) | |
| expose(:master_categories) { MasterCategory.all } | |
| def show | |
| if step == :categories and magnet_app.categories.empty? | |
| magnet_app.generate_categories! | |
| elsif step == :pages |
- DHH's Put Chubby Models on a Diet
- Code Climate's 7 Patterns to Refactor Fat Models
- Mike Pack's The Right Way to Code DCI in Ruby
- DCI Vision by its creator Trygve Reenskaug
- Giles Bowkett's Rails As She Is Spoke
- Avdi Grimm's Objects on Rails
- Jim Gay's Clean Ruby
- Corey Haines' Why I Don't Use ActiveSupport::Concern or, why I actively replace ActiveSupport::Concern with Ruby in codebases I work on
From @_swanson:
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
| function rserv() | |
| { | |
| rport=3000 | |
| port_taken=`lsof -i tcp:${rport}` | |
| while [ $port_taken ] | |
| do | |
| echo "Port ${rport} taken..." | |
| (( rport++ )) | |
| port_taken=`lsof -n -i tcp:${rport}` | |
| done |
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
| --- | |
| type: chapter | |
| title: Indy.rb November 2012 | |
| subtitle: Microframework Hack Night | |
| --- | |
| type: text | |
| title: Sponsored by... | |
| content: | | |
| Thanks iGoDigital! |
We broke up into several groups, picked one out of a handful of Ruby microframeworks, and hacked together a Reddit clone - or, as much as we could build in about an hour. Below are some of the results:
App: Dark Roast
Participants: David Jones, Timothy Barnes, Gentleman Whose Name Remains a Mystery to My Feeble Mind