This file contains 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 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 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 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 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 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 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 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
$ mm-init my_fine_project | |
create my_fine_project/config.rb | |
create my_fine_project/source/index.html.erb | |
create my_fine_project/source/layout.erb | |
create my_fine_project/source/stylesheets | |
create my_fine_project/source/stylesheets/site.css.scss | |
create my_fine_project/source/javascripts | |
create my_fine_project/source/images |
This file contains 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
$ -> | |
bands = null | |
class Band extends Backbone.Model | |
initialize: -> | |
console.log "initializing model #{@inspect()}" | |
inspect: -> | |
console.log "inspect" | |
s = [] |
This file contains 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
$ brew install coffee-script | |
==> Downloading http://github.com/jashkenas/coffee-script/tarball/0.9.2 | |
######################################################################## 100.0% | |
==> ./bin/cake --prefix /usr/local/Cellar/coffee-script/0.9.2 install | |
/usr/local/Cellar/coffee-script/0.9.2: 33 files, 556K, built in 2 seconds |