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
| # RecycleApp | |
| module RecycleApp | |
| class << self | |
| attr_accessor :can_store | |
| def config | |
| yield self | |
| end | |
| end | |
| 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
| require "json" | |
| require "rake-pipeline-web-filters" | |
| input "assets" | |
| output "public" | |
| class HandlebarsFilter < Rake::Pipeline::Filter | |
| def initialize(&block) | |
| block ||= proc { |input| input.sub(/\.handlebars$/, '.js') } | |
| super(&block) |
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
| TwitterBrowser.EnterUserNameView = SC.TextField.extend({ | |
| insertNewline: function() { | |
| TwitterBrowser.statechart.sendEvent('searchForUser', this.get('value')); | |
| } | |
| }); | |
| TwitterBrowser.statechart = SC.Statechart.create({ | |
| searchForUser: function(userName) { | |
| var recordArray = TwitterBrowser.store.find( | |
| SC.Query.local(TwitterBrowser.User, "userName ='" + userName + "'", {userName: userName})); |
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
| # Install with: | |
| # bash < <(curl -L https://raw.github.com/gist/1780623) | |
| # | |
| # Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug | |
| echo "Installing ruby-debug with ruby-1.9.3-p0 ..." | |
| curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
| curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem |
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 AddComment | |
| attr_reader :observer, :store, :success, :fail | |
| def initializer(observer, store) | |
| @observer, @store = observer, store | |
| yield self if block_given? | |
| return self | |
| end | |
| def call(post_id, comment_attrs) |
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
| customer = Shop::Directory.new(repository: User).find(1001) | |
| product = Shop::Warehouse.new(repository: Product).find(1002) | |
| transaction = Shop::Transaction.new(customer: customer, product: product, orders: Orders.new(repository: Order)) | |
| transaction.commit | |
| module Shop | |
| class Warehouse | |
| attr_reader :repository |
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
| def index | |
| @stockist_countries = StockistCountry.active_stockists | |
| 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
| module MyApp | |
| BusinessException = Class.new(StandardError) | |
| class Post | |
| attr_reader :record | |
| def initialize(args) | |
| @record = args[:record] |
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 Post < ActiveRecord::Base | |
| has_many :comments | |
| # SERVICES | |
| def comment(attributes) | |
| create_comment(attributes) | |
| 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 MyApp::Post | |
| attr_reader :record | |
| def initialize(args) | |
| @record = args[:record] | |
| end | |
| def comment(attributes) | |
| create_comment(attributes) |