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 Board | |
| def initialize | |
| self.squares = Array.new(9) | |
| end | |
| def rows | |
| self.squares.each_slice(3) | |
| 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
| App.ApplicationRoute = Ember.Route.extend | |
| setupController: () -> | |
| @controllerFor('discussionPosts').set('model', App.DiscussionPost.find()) |
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
| [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ] || return | |
| source /usr/local/share/chruby/chruby.sh | |
| source /usr/local/share/chruby/auto.sh | |
| chruby ruby-1.9.3 |
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
| Meloria.Customer = DS.Model.extend({ | |
| name: DS.attr('string'), | |
| phone: DS.attr('string'), | |
| email: DS.attr('string'), | |
| dateOnWaitingList: DS.attr('date'), | |
| status: DS.attr('number'), | |
| local: DS.attr('boolean'), |
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
| Ember.Application.initializer({ | |
| name: 'debug' | |
| initialize: (container, app) -> | |
| app.d = app.debug = | |
| controller: (name) -> container.lookup("controller:#{name}") | |
| c: (name) -> container.lookup("controller:#{name}") | |
| route: (name) -> container.lookup("route:#{name}") | |
| r: (name) -> container.lookup("route:#{name}") |
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
| array = %w(dog cat aardvark) | |
| array.each {|animal| puts animal.upcase } | |
| array.map! {|animal| animal.reverse } | |
| array.select {|animal| animal.include? 'a' } | |
| array.sort_by(&:length) | |
| array << 'dog' | |
| array.uniq! | |
| hash = {cat: "meow", dog: "woof", aardvark: "sluuurp"} | |
| hash.keys.join(" and ") |
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
| App.CommentsNewRoute = Ember.Route.extend({ | |
| model: function() { | |
| return this.store.createRecord('comment', {post: this.modelFor('post')}); | |
| }, | |
| actions: { | |
| save: function() { | |
| var model = this.modelFor('commentsNew'); | |
| model.save().then( |
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
| private def confirm_failure(error) | |
| self.error = error | |
| run_failure_callbacks | |
| end | |
| private def run_failure_callbacks | |
| # This line fails because on_failure responds_to #call ?! | |
| on_failure.call(self) if on_failure.respond_to?(:call) | |
| 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 'active_record' | |
| module Skywalker | |
| class Command | |
| ################################################################################ | |
| # Class interface | |
| ################################################################################ | |
| def self.call(*args) | |
| new(*args).call | |
| 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 'skywalker/command' | |
| module Skywalker | |
| class Command | |
| def transaction(&block) | |
| block.call | |
| end | |
| end | |
| end |