Different services I can suggest when a non-tech friend or family member asks me how they can cheaply make a website and possibly use it to sell stuff online.
Website Hosting
| class Project | |
| def penguin | |
| self.class.where(:something => parent_object.something) | |
| end | |
| end |
| // Generated from Ruby: | |
| // JSON.pretty_generate Scale.all.map do |s| | |
| // {:name => s.name, :modes => s.modes.inject({}) {|b,m| b[m.name] = m.tones.map(&:tone); b} } | |
| // end | |
| [ | |
| { | |
| "name": "Major", |
| require "capybara/rails" | |
| class PngRenderer | |
| include Capybara::DSL | |
| DEFAULT_PATH = Rails.root.join("public/images/rendered") | |
| def initialize(url) | |
| @url = url | |
| end |
| require "capybara/rails" | |
| Capybara.javascript_driver = :webkit | |
| class StaffToPng | |
| @queue = :staff_to_png | |
| def self.perform(chord) | |
| visit "/chords/#{chord}" | |
| page.driver.render "generations/#{chord}.png" |
| class City | |
| def freezing? | |
| case name | |
| when "San Diego" | |
| current_temperature < 60 | |
| when "Austin" | |
| current_temperature < 50 | |
| when "Rochester" | |
| current_temperature < -10 | |
| else |
| class Scale < ActiveRecord::Base | |
| include KeyContext | |
| has_many :tones, :class_name => 'ScaleTone', :extend => ToneSequence, :dependent => :destroy | |
| delegate :notes, :to => :tones | |
| end |
| #!/usr/bin/env ruby | |
| MAPPINGS = { | |
| "I" => 1, | |
| "V" => 5, | |
| "X" => 10, | |
| "L" => 50, | |
| "C" => 100, | |
| "D" => 500, | |
| "M" => 1000 | |
| } |
| # MODEL | |
| class Theater | |
| named_scope :with_recent_comments, | |
| :select => "*, recent_comments.created_at AS last_comment_at", | |
| :joins => "INNER JOIN (SELECT id, entity_id, created_at FROM comments WHERE entity_type = 'Theater' ORDER by id DESC LIMIT 100) | |
| AS recent_comments ON recent_comments.entity_id = theaters.id", | |
| :order => "recent_comments.created_at DESC" | |
| end |
| # MODEL | |
| class Theater | |
| named_scope :with_recent_comments, | |
| :select => "*, recent_comments.created_at AS last_comment_at", | |
| :joins => "INNER JOIN (SELECT id, entity_id, created_at FROM comments WHERE entity_type = 'Theater' LIMIT 100) | |
| AS recent_comments ON recent_comments.entity_id = theaters.id", | |
| :order => "recent_comments.created_at DESC" | |
| end |
Different services I can suggest when a non-tech friend or family member asks me how they can cheaply make a website and possibly use it to sell stuff online.
Website Hosting