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
| SlideShow = | |
| current_image: 0, | |
| max_images: 0, | |
| init: -> | |
| $slideshow = $('#slideshow > div ul') | |
| $slideshow.find('li').hide().eq(0).show() | |
| @max_images = $slideshow.find('li').length | |
| @change_slide($slideshow) |
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
| [alias] | |
| co = checkout | |
| # Log display from screencast, with train tracks. | |
| l = log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset' | |
| # Alternate log display from Scott Chacon | |
| lol = log --pretty=oneline --abbrev-commit --graph --decorate | |
| # Other useful aliases: | |
| unstage = reset HEAD | |
| staged = diff --cached | |
| unstaged = diff |
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
| - edit ||= false | |
| %label Search | |
| %input#filter | |
| %hr | |
| %table.footable{"data-filter" => "#filter"} | |
| %thead | |
| %tr |
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
| %label Search | |
| %input#filter | |
| %hr | |
| %table.footable{"data-filter" => "#filter"} | |
| %thead | |
| %tr | |
| - if block | |
| %th |
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 Forms::StudentWithProfileForm | |
| extend ActiveModel::Naming | |
| include ActiveModel::Conversion | |
| include ActiveModel::Validations | |
| def persisted? | |
| false | |
| end | |
| ATTRIBUTES = [:first_name, :last_name, :email, :grade, :locale, :country] |
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 ArtistsController < ApplicationController | |
| def create | |
| @form = create_new_form | |
| workflow = Workflows::ArtistWorkflow.new(@form, params[:artist]) | |
| workflow.process do |obj| | |
| return respond_with obj | |
| end | |
| render :new |
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 PointLedger | |
| attr_reader :user | |
| def initialize(user) | |
| @user = user | |
| end | |
| def add(amount, item) | |
| user.point_transactions.build(amount: amount, item_type: item.class, item_name: item.name) | |
| user.points += amount |
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 Purchase | |
| class Item | |
| attr_reader :student, :item | |
| delegate :cost, to: :item | |
| def initialize(student, item) | |
| @student = student | |
| @item = item | |
| 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 PointLedger | |
| attr_reader :student | |
| def initialize(student) | |
| @student = student | |
| end | |
| def add(amount, item) | |
| create_point_transaction(amount, item) | |
| student.points += amount |
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 PurchasesController < ApplicationController | |
| def create | |
| purchase_service = service_lookup[params[:purchase_type]] | |
| item_class = item_class_lookup[params[:purchase_type]] | |
| item = item_class.find_by(name: params[:item_name]) | |
| purchase_service.new(current_student, item).purchase | |
| redirect_to map_path | |
| end |