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
| aSingleBand = new Band(name: 'Foo Fighters') |
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
| !!!5 | |
| %html | |
| %head | |
| %meta{:charset => "utf-8"} | |
| // Always force latest IE rendering engine (even in intranet) & Chrome Frame | |
| %meta{:content => "IE=edge,chrome=1"} | |
| %meta{"http-equiv" => "X-UA-Compatible"} | |
| = stylesheet_link_tag "site.css" | |
| = javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" |
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
| - content_for :head do | |
| %title The Middleman! | |
| %h1 The Middleman is watching. | |
| #band-app | |
| %table#band-list | |
| %thead | |
| %tr | |
| %td | |
| %a#sort-name{:href => '#'} |
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
| SONG_TEMPLATE = ''' | |
| <table> | |
| {{#if songs.length }} | |
| {{#each songs}} | |
| <tr><td>{{ this.name }}</td><td>{{ this.duration }}</td></tr> | |
| {{/each}} | |
| {{/if}} | |
| </table> | |
| ''' |
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 SaveCancelToolbar < UIToolbar | |
| attr_writer :delegate | |
| def initWithFrame frame, andTitle: title | |
| super | |
| items = [] | |
| spacer = UIBarButtonItem.alloc.initWithBarButtonSystemItem(UIBarButtonSystemItemFlexibleSpace, target:nil, action:nil) | |
| @cancel_button = UIBarButtonItem.alloc.initWithBarButtonSystemItem(UIBarButtonSystemItemCancel, target:self, action:'on_cancel:') |
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 MixinTemplate | |
| def self.included(base) | |
| base.extend(ClassMethods) | |
| base.instance_variable_set('@my_data', []) | |
| end | |
| module ClassMethods | |
| ... | |
| 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 String | |
| def add_formatted(str, format = '%s') | |
| return self if str.nil? | |
| self << format % str if str.length > 0 | |
| self | |
| end | |
| def to_us_phone | |
| phone = self.dup.gsub(/[^\d]/, '') | |
| last = phone[-4..-1] |
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
| # See https://gist.github.com/4526905 for the code this tests | |
| describe "core helpers" do | |
| it "has a 'to_us_phone' method" do | |
| 'hello'.should.respond_to? :to_us_phone | |
| end | |
| describe "7-digit phone numbers" do | |
| it "formats string" do | |
| '1112222'.to_us_phone.should == '111-2222' |
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 MotionModel | |
| module Model | |
| def save(*) | |
| puts "called MM#save" | |
| end | |
| end | |
| end | |
| module MotionModel | |
| module Paranoid |
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 SugarCube | |
| module DateParser | |
| # Parse a date string: E.g.: | |
| # | |
| # SugarCube::DateParser.parse_date "There is a date in here tomorrow at 9:00 AM" | |
| # | |
| # => 2013-02-20 09:00:00 -0800 | |
| def self.parse_date(date_string) | |
| detect(date_string).first.date | |
| end |