Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Developer? Store owner? Both?

Slide 3

Slide 3 text

~ ⚡ whoami Wynn Netherland

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

I’m

Slide 7

Slide 7 text

175 slides, 45 minutes

Slide 8

Slide 8 text

LET'S DO THIS!

Slide 9

Slide 9 text

Titles are the new bullets.

Slide 10

Slide 10 text

3.5 years ago...

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Polyphonic

Slide 15

Slide 15 text

having two or more independent but harmonically related melodic parts sounding together pol·y·phon·ic adjective:

Slide 16

Slide 16 text

Are you listening to your store?

Slide 17

Slide 17 text

Cha-ching!

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Click-a-click-click-whiff!

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Click-a-click-click-boom!

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Click-a-chug-a-chug-a

Slide 25

Slide 25 text

Wasn't Jeff Casimir's talk great?

Slide 26

Slide 26 text

Polymorphic

Slide 27

Slide 27 text

occurring in or having many forms or shapes or appearances pol·y·morph·ic adjective:

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Why?

Slide 31

Slide 31 text

your store != my store

Slide 32

Slide 32 text

your business != my business

Slide 33

Slide 33 text

Branding, trust.

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

Geographic sensibilities

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

Methods of Spree customization

Slide 39

Slide 39 text

Extensions

Slide 40

Slide 40 text

Extensions refer to discrete packages of code that provide new functionality to a Spree application, while extensions may affect the appearance of a Spree application they generally only provide additional interfaces to enable users to interact with the new functionality provided.

Slide 41

Slide 41 text

Extensions refer to discrete packages of code that provide new functionality to a Spree application, while extensions may affect the appearance of a Spree application they generally only provide additional interfaces to enable users to interact with the new functionality provided.

Slide 42

Slide 42 text

Themes

Slide 43

Slide 43 text

Themes are discrete packages of code that only affect the appearance of a Spree application (and generally only the front-end store). Themes do not generally include any logic customizations.

Slide 44

Slide 44 text

Themes are discrete packages of code that only affect the appearance of a Spree application (and generally only the front-end store). Themes do not generally include any logic customizations.

Slide 45

Slide 45 text

Powered by Rails Engines Wasn't Ryan Bigg's talk great?

Slide 46

Slide 46 text

(Good conferences aren't DRY)

Slide 47

Slide 47 text

The Asset Pipeline

Slide 48

Slide 48 text

We rename Und now vee dance.

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

precompile is your friend

Slide 51

Slide 51 text

bundle exec rake assets:precompile RAILS_ENV=development

Slide 52

Slide 52 text

drwxr-xr-x 17 wynn staff 578 Nov 2 08:36 . drwxr-xr-x 8 wynn staff 272 Nov 2 08:35 .. drwxr-xr-x 16 wynn staff 544 Nov 2 08:36 admin -rw-r--r-- 1 wynn staff 155 Nov 2 08:30 application.css -rw-r--r-- 1 wynn staff 143 Nov 2 08:30 application.css.gz drwxr-xr-x 7 wynn staff 238 Nov 2 08:36 creditcards drwxr-xr-x 3 wynn staff 102 Nov 2 08:36 datepicker -rw-r--r-- 1 wynn staff 1150 Nov 2 08:19 favicon.ico drwxr-xr-x 6 wynn staff 204 Nov 2 08:36 icons drwxr-xr-x 4 wynn staff 136 Nov 2 08:36 jqPlot drwxr-xr-x 15 wynn staff 510 Nov 2 08:36 jquery-ui drwxr-xr-x 3 wynn staff 102 Nov 2 08:35 jquery.alerts drwxr-xr-x 3 wynn staff 102 Nov 2 08:35 jquery.jstree -rw-r--r-- 1 wynn staff 6694 Nov 2 08:36 manifest.yml drwxr-xr-x 5 wynn staff 170 Nov 2 08:36 noimage -rw-r--r-- 1 wynn staff 1608 Nov 2 08:19 spinner.gif drwxr-xr-x 6 wynn staff 204 Nov 2 08:36 store

Slide 53

Slide 53 text

active_reload is a must Included in Rails 3.2

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

Anatomy of a theme

Slide 57

Slide 57 text

spree_rdr_theme [ master: ✔ ] 6d ⚡ tree -d

Slide 58

Slide 58 text

spree_rdr_theme [ master: ✔ ] 6d ⚡ tree -d . ├── app │ ├── assets │ │ ├── images │ │ │ └── store │ │ │ └── icons │ │ ├── javascripts │ │ │ └── store │ │ └── stylesheets │ │ └── store │ ├── overrides │ └── views │ └── spree │ ├── shared │ └── wishlists ├── lib │ └── generators │ └── spree_rdr_theme │ └── install └── vendor └── assets ├── images │ └── fancybox ├── javascripts └── stylesheets

Slide 59

Slide 59 text

spree_rdr_theme [ master: ✔ ] 6d ⚡ tree -d . ├── app │ ├── assets │ │ ├── images │ │ │ └── store │ │ │ └── icons │ │ ├── javascripts │ │ │ └── store │ │ └── stylesheets │ │ └── store │ ├── overrides │ └── views │ └── spree │ ├── shared │ └── wishlists ├── lib │ └── generators │ └── spree_rdr_theme │ └── install └── vendor └── assets ├── images │ └── fancybox ├── javascripts └── stylesheets Your stuff

Slide 60

Slide 60 text

spree_rdr_theme [ master: ✔ ] 6d ⚡ tree -d . ├── app │ ├── assets │ │ ├── images │ │ │ └── store │ │ │ └── icons │ │ ├── javascripts │ │ │ └── store │ │ └── stylesheets │ │ └── store │ ├── overrides │ └── views │ └── spree │ ├── shared │ └── wishlists ├── lib │ └── generators │ └── spree_rdr_theme │ └── install └── vendor └── assets ├── images │ └── fancybox ├── javascripts └── stylesheets Your Stylesheets, images, JavaScripts

Slide 61

Slide 61 text

spree_rdr_theme [ master: ✔ ] 6d ⚡ tree -d . ├── app │ ├── assets │ │ ├── images │ │ │ └── store │ │ │ └── icons │ │ ├── javascripts │ │ │ └── store │ │ └── stylesheets │ │ └── store │ ├── overrides │ └── views │ └── spree │ ├── shared │ └── wishlists ├── lib │ └── generators │ └── spree_rdr_theme │ └── install └── vendor └── assets ├── images │ └── fancybox ├── javascripts └── stylesheets Your Deface overrides

Slide 62

Slide 62 text

Deface Wasn't Brian Quinn's talk great?

Slide 63

Slide 63 text

Deface::Override.new(:virtual_path => "posts/_form", :name => "example-1", :replace => "h1", :text => "

New Post

") Deface::Override.new(:virtual_path => "posts/_form", :name => "example-1", :replace => "h1") do "

New Post

" end In a block

Slide 64

Slide 64 text

spree_rdr_theme [ master: ✔ ] 6d ⚡ tree -d . ├── app │ ├── assets │ │ ├── images │ │ │ └── store │ │ │ └── icons │ │ ├── javascripts │ │ │ └── store │ │ └── stylesheets │ │ └── store │ ├── overrides │ └── views │ └── spree │ ├── shared │ └── wishlists ├── lib │ └── generators │ └── spree_rdr_theme │ └── install └── vendor └── assets ├── images │ └── fancybox ├── javascripts └── stylesheets Your custom views

Slide 65

Slide 65 text

spree_rdr_theme [ master: ✔ ] 6d ⚡ tree -d . ├── app │ ├── assets │ │ ├── images │ │ │ └── store │ │ │ └── icons │ │ ├── javascripts │ │ │ └── store │ │ └── stylesheets │ │ └── store │ ├── overrides │ └── views │ └── spree │ ├── shared │ └── wishlists ├── lib │ └── generators │ └── spree_rdr_theme │ └── install └── vendor └── assets ├── images │ └── fancybox ├── javascripts └── stylesheets Third party libraries and frameworks

Slide 66

Slide 66 text

Polyglotnic Ok, so I made that one up

Slide 67

Slide 67 text

A person having a speaking, reading, or writing knowledge of several languages pol·y·glot adjective:

Slide 68

Slide 68 text

CSS3

Slide 69

Slide 69 text

border-radius

Slide 70

Slide 70 text

border-image

Slide 71

Slide 71 text

www.zurb.com/playground/awesome-overlays

Slide 72

Slide 72 text

background-size

Slide 73

Slide 73 text

gradients

Slide 74

Slide 74 text

RGBA, HSL, HSLA colors rgba (0,0,0,1) is the new black!

Slide 75

Slide 75 text

text-shadow

Slide 76

Slide 76 text

box-shadow

Slide 77

Slide 77 text

word wrap

Slide 78

Slide 78 text

outline

Slide 79

Slide 79 text

columns

Slide 80

Slide 80 text

@font-face Typographic freedom! means

Slide 81

Slide 81 text

New selectors Cool

Slide 82

Slide 82 text

* E .class #id E F E > F E + F E[attribute] E[attribute=value] E[attribute~=value] E[attribute|=value] :first-child :link :visited :lang() :before ::before :after ::after :first-letter ::first-letter :first-line ::first-line E[attribute^=value] E[attribute$=value] E[attribute*=value] E ~ F :root :last-child :only-child :nth-child() :nth-last-child() :first-of-type :last-of-type :only-of-type :nth-of-type() :nth-last-of-type() :empty :not() :target :enabled :disabled :checked CSS3 selectors (and some golden oldies) :header Steal this from jQuery, please

Slide 83

Slide 83 text

CSS Frameworks

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

Percentage-based grid, screenshot in Firefox 4.0 http://host.sonspring.com/yui3_grid

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

Sass

Slide 91

Slide 91 text

Nested rules

Slide 92

Slide 92 text

table.users tr td {background: #111} table.users tr td a {color: #333} Nested rules - selectors

Slide 93

Slide 93 text

table.users { tr { td { background: #d1d1d; a { color: #111; } } } } Nested rules - selectors

Slide 94

Slide 94 text

table.users { tr { td { color: #111; &.alt { color: #333; } &:hover { color: #666; } } } } Nested rules - selectors

Slide 95

Slide 95 text

.users { font: { size: 1.2em; style: italics; weight: bold; } } Nested rules - properties

Slide 96

Slide 96 text

Syntax options

Slide 97

Slide 97 text

table.users { tr { td { background: #d1d1d; a { color: #111; } } } } Syntax options - SCSS Sassy CSS!

Slide 98

Slide 98 text

table.users tr td background: #d1d1d a color: #111 Syntax options - Indented I — whitespace

Slide 99

Slide 99 text

Variables

Slide 100

Slide 100 text

.user { background: #333; border-size: 2px; } .owner { background: #333; border-size: 2px; } .admin { background: #666; border-size: 4px; } Variables

Slide 101

Slide 101 text

$gray: #333; $default_border: 2px; .user { background: $gray; border-size: $default_border;} .owner { background: $gray; border-size: $default_border;} .admin { background: $gray + #333; border-size: $default_border + 2px; } Variables Even math! and color mixing!

Slide 102

Slide 102 text

Mixins

Slide 103

Slide 103 text

.avatar { padding: 2px; border: solid 1px #ddd; position: absolute; top: 5px; left: 5px; } p img { padding: 2px; border: solid 1px #ddd; } Mixins

Slide 104

Slide 104 text

@mixin frame($padding_width: 2px, $border_color: #ddd) { padding: $padding_width; border: { width: 1px; style: solid; color $border_color; } } .avatar { @include frame; position: absolute; top: 5px; left: 5px; } p img { @include frame(1px, #ccc);} Mixins defines the mixin mixes in the rules

Slide 105

Slide 105 text

Extend

Slide 106

Slide 106 text

.flash { padding: 5px; border-width: 1px; font-weight: bold; } .error { color: #8a1f11; background: #fbe3e4; } .notice { color: #514721; background: #fff6bf; } Mixins

Slide 107

Slide 107 text

.flash { padding: 5px; border-width: 1px; font-weight: bold; } .error { @extend .flash; color: #8a1f11; background: #fbe3e4; } .notice { @extend .flash; color: #514721; background: #fff6bf; } Mixins

Slide 108

Slide 108 text

.flash, .error, .notice { padding: 5px; border-width: 1px; font-weight: bold; } .error { color: #8a1f11; background: #fbe3e4; } .notice { color: #514721; background: #fff6bf; } Mixins now we can use a single class in our markup

Slide 109

Slide 109 text

Imports

Slide 110

Slide 110 text

@import url(/css/reset.css) @import url(/css/typography.css) @import url(/css/layout.css) Imports parent + 3 @imports = 4 HTTP requests

Slide 111

Slide 111 text

@import "reset.scss" # _reset.scss @import "typography" # _typography.scss @import "layout.css" # url(layout.css) Imports Included at compile time - just one http request

Slide 112

Slide 112 text

Imports + Mixins Now it gets fun!

Slide 113

Slide 113 text

A brief detour

Slide 114

Slide 114 text

Vendor prefixes and the growing -webkit monoculture

Slide 115

Slide 115 text

Every Time You Call a Proprietary Feature “CSS3,” a Kitten Dies by L E A V E R O U

Slide 116

Slide 116 text

Prefix or Posthack by E R I C M E Y E R

Slide 117

Slide 117 text

“It’s time to abolish all vendor prefixes. They’ve become solutions for which there is no problem, and they are actively harming web standards.” — Peter-Paul Koch aka @ppk http://www.quirksmode.org/blog/archives/2010/03/css_vendor_pref.html

Slide 118

Slide 118 text

Ummm. Not so fast.

Slide 119

Slide 119 text

@import "compass/css3.scss"; .callout { @include border-radius(5px); @include linear-gradient("left top", "left bottom", #fff, #ddd); } .callout { -moz-border-radius: 5px; -webkit-border-radius: 5px; -border-radius: 5px; background-image: -moz-linear-gradient(top, bottom, from(#fff), to(#ddd)); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.00, #fff), color-stop(1.00, #ddd)); } Compass CSS3 mixins very different syntax

Slide 120

Slide 120 text

“Well, reactions to my proposal to abolish vendor prefixes are mixed, and I might have overshot my target here.” -Peter-Paul Koch aka @ppk http://www.quirksmode.org/blog/archives/2010/03/css_vendor_pref_1.html

Slide 121

Slide 121 text

Solutions?

Slide 122

Slide 122 text

beta-new-css8-property-dilly isn't that just like not having it? ...and we're back.

Slide 123

Slide 123 text

Vendor specific stylesheets Maybe. But I'd like to retain Internet Explorer's special status unto itself

Slide 124

Slide 124 text

CSS preprocesors Hey, funny you should ask!

Slide 125

Slide 125 text

Bring your favorite CSS Framework

Slide 126

Slide 126 text

...
...
...
A Blueprint example boo? / Yay?

Slide 127

Slide 127 text

#wrapper { @include container; #content { @include column(7); @include append(1); #featured { @include column(5, true); } } #sidebar { @include column(3, true); @include prepend(1); } } A Blueprint example

Slide 128

Slide 128 text

Look, Ma! No math!

Slide 129

Slide 129 text

Functions

Slide 130

Slide 130 text

Very. Powerful. Functions.

Slide 131

Slide 131 text

hue(#cc3) => 60deg saturation(#cc3) => 60% lightness(#cc3) => 50% adjust-hue(#cc3, 20deg) => #9c3 saturate(#cc3, 10%) => #d9d926 desaturate(#cc3, 10%) => #bfbf40 lighten(#cc3, 10%) => #d6d65c darken(#cc3, 10%) => #a3a329 grayscale(#cc3) => desaturate(#cc3, 100%) = #808080 complement(#cc3) => adjust-hue(#cc3, 180deg) = #33c mix(#cc3, #00f) => #e56619 mix(#cc3, #00f, 10%) => #f91405 mix(#cc3, #00f, 90%) => #d1b72d Sass 2.4 color functions http://nex-3.com/posts/89-powerful-color-manipulation-with-sass

Slide 132

Slide 132 text

mix(rgba(51, 255, 51, 0.75), #f00) => rgba(178, 95, 19, 0.875) mix(rgba(51, 255, 51, 0.90), #f00) => rgba(163, 114, 22, 0.95) alpha(rgba(51, 255, 51, 0.75)) => 0.75 opacity(rgba(51, 255, 51, 0.75)) => 0.75 opacify(rgba(51, 255, 51, 0.75), 0.1) => rgba(51, 255, 51, 0.85) fade-in(rgba(51, 255, 51, 0.75), 0.1) => rgba(51, 255, 51, 0.85) transparentize(rgba(51, 255, 51, 0.75), 0.1) => rgba(51, 255, 51, 0.65) fade-out(rgba(51, 255, 51, 0.75), 0.1) => rgba(51, 255, 51, 0.65) Sass color functions with alpha support! http://nex-3.com/posts/89-powerful-color-manipulation-with-sass

Slide 133

Slide 133 text

No content

Slide 134

Slide 134 text

Sass and Compass CSS extensions & compiler Patterns & plugins

Slide 135

Slide 135 text

...like peas and carrots.

Slide 136

Slide 136 text

A quick survey of Compass

Slide 137

Slide 137 text

CSS3

Slide 138

Slide 138 text

CSS3 ★ Appearance ★ Background Clip ★ Background Origin ★ Background Size ★ Border Radius ★ Box ★ Box Shadow ★ Box Sizing ★ CSS3 Pie ★ Columns ★ Font Face ★ Gradient ★ Images ★ Inline Block ★ Opacity ★ Shared Utilities ★ Text Shadow ★ Transform ★ Transform (legacy) ★ Transition

Slide 139

Slide 139 text

Image sprites

Slide 140

Slide 140 text

@import "icon/*.png" .actions .new +icon-sprite(new) .edit +icon-sprite(edit) .save +icon-sprite(save) .delete +icon-sprite(delete) Image sprites .icon-sprite, .actions .new, .actions .edit, .actions .save, .actions .delete { background: url('/images/icon-34fe0604ab.png') no-repeat; } .actions .new { background-position: 0 -64px; } .actions .edit { background-position: 0 -32px; } .actions .save { background-position: 0 -96px; } .actions .delete { background-position: 0 0; } @import "icon/*.png" public/images/icon/new.png public/images/icon/edit.png public/images/icon/save.png public/images/icon/delete.png 1. 2. 3. I like the Sprite in you®

Slide 141

Slide 141 text

URL helpers

Slide 142

Slide 142 text

#nav background: image-url("nav_bg.png") repeat-x top center DEVELOPMENT #nav { background: url("/images/nav_bg.png") repeat-x top center; } PRODUCTION #nav { background: url("http://assets.example.com/images/nav_bg.png") repeat-x top center; } URL helpers relative paths for development, absolute for production

Slide 143

Slide 143 text

stylesheet-url($path) font-url($path) image-url($path) URL helpers

Slide 144

Slide 144 text

Share your patterns

Slide 145

Slide 145 text

http://brandonmathis.com/projects/fancy-buttons/

Slide 146

Slide 146 text

@import "fancy-buttons" button, a.button +fancy-button(#2966a8)

Slide 147

Slide 147 text

compass-960

Slide 148

Slide 148 text

$ninesixty-columns: 16 #wrap +grid-container #left-nav +alpha +grid(5) #main-content +grid-prefix(1) +grid(10) +omega Compass 960 https://github.com/chriseppstein/compass-960-plugin

Slide 149

Slide 149 text

compass-wordpress

Slide 150

Slide 150 text

$ gem install compass-wordpress CRANK OUT A NEW SASS-Y WORDPRESS THEME $ compass -r compass-wordpress \ -f wordpress -p thematic \ --sass-dir=sass --css-dir=css \ -s compressed my_awesome_theme AUTOCOMPILE YOUR CHANGES $ compass --watch Compass and WordPress shameless plug

Slide 151

Slide 151 text

compass-formalize

Slide 152

Slide 152 text

No content

Slide 153

Slide 153 text

Isn’t she Sassy, folks? GET THE BOOK.

Slide 154

Slide 154 text

sass40 Save 40% and get early access! Sadly, sass100 is not a valid code.

Slide 155

Slide 155 text

Haml

Slide 156

Slide 156 text

<%= "boo" %>

Slide 157

Slide 157 text

#profile .left.column #date= print_date #address= current_user.address .right.column #email= current_user.email #bio= current_user.bio HAML
<%= print_date %>
<%= current_user.address %> div>
<%= current_user.email %>
<%= current_user.bio %>
ERB

Slide 158

Slide 158 text

Think and work in CSS selectors

Slide 159

Slide 159 text

Never chase that again

Slide 160

Slide 160 text

COFFEESCRIPT

Slide 161

Slide 161 text

It's still just JavaScript.

Slide 162

Slide 162 text

Compiles right in the AP

Slide 163

Slide 163 text

charity [ master: ✔ ] 1d ⚡ tree app/assets/ app/assets/javascripts/ ├── application.js.coffee ├── ie8.js.coffee ├── media.js.coffee ├── mobile.js.coffee ├── pc │ ├── _boot.js.coffee │ ├── models │ │ ├── campaign.js.coffee │ │ ├── campaigns.js.coffee │ │ ├── project.js.coffee │ │ ├── projects.js.coffee │ │ └── scoreboard.js.coffee │ ├── routers │ │ └── discover.js.coffee │ └── views │ ├── calc.js.coffee │ ├── cropper.js.coffee │ ├── data_table.js.coffee │ ├── discover │ │ ├── app.js.coffee │ │ ├── campaigns_panel.js.coffee │ │ ├── map.js.coffee

Slide 164

Slide 164 text

var foo = function () { } foo = () -> I’d rather write this. JAVASCRIPT COFFEESCRIPT

Slide 165

Slide 165 text

var button = Titanium.UI.createButton({ title: 'I am a Button', height: 40, width: 200, top: 10 }); button.addEventListener('click', function(e) { alert("Oooh, that tickles!"); }); JAVASCRIPT

Slide 166

Slide 166 text

button = Titanium.UI.createButton title: 'I am a Button' height: 40 width: 200 top: 10 button.addEventListener 'click', (e) -> alert "Oooh, that tickles!" COFFEESCRIPT

Slide 167

Slide 167 text

It's about more than aesthetics ;{ } For me,

Slide 168

Slide 168 text

Some of my favorite features...

Slide 169

Slide 169 text

for own key, value of query uri += "#{ key }=#{ escape(value) }&" COFFEESCRIPT var key, value; var __hasProp = Object.prototype.hasOwnProperty; for (key in query) { if (!__hasProp.call(query, key)) continue; value = query[key]; uri += "" + key + "=" + (escape(value)) + "&"; } JAVASCRIPT

Slide 170

Slide 170 text

for own key, value of query uri += "#{ key }=#{ escape(value) }&" COFFEESCRIPT Comprehensions

Slide 171

Slide 171 text

for own key, value of query uri += "#{ key }=#{ escape(value) }&" COFFEESCRIPT Interpolation

Slide 172

Slide 172 text

courseButtonSubhead = Ti.UI.createLabel className: 'optRowSubhead' text: "#{GolfStatus.App.currentGame?.green?.name}" COFFEESCRIPT The Existential Operator

Slide 173

Slide 173 text

class GolfStatus.Models.Game constructor: (@owner, @course, @playingFor='brag', @scoringFormat='low_net') -> @players = {} @addPlayer @owner if @owner @green = @course.greens[0] if @course @currentHole = 1 @maxHolePlayed = 1 # elsewhere game = new GolfStatus.Models.Game(...) COFFEESCRIPT Simple inheritance pattern

Slide 174

Slide 174 text

class GolfStatus.Models.Game constructor: (@owner, @course, @playingFor='brag', @scoringFormat='low_net') -> @players = {} @addPlayer @owner if @owner @green = @course.greens[0] if @course @currentHole = 1 @maxHolePlayed = 1 COFFEESCRIPT @

Slide 175

Slide 175 text

class GolfStatus.Models.Game constructor: (@owner, @course, @playingFor='brag', @scoringFormat='low_net') -> @players = {} @addPlayer @owner if @owner @green = @course.greens[0] if @course @currentHole = 1 @maxHolePlayed = 1 COFFEESCRIPT Default values

Slide 176

Slide 176 text

class GolfStatus.Models.Game constructor: (@owner, @course, @playingFor='brag', @scoringFormat='low_net') -> @players = {} @addPlayer @owner if @owner @green = @course.greens[0] if @course @currentHole = 1 @maxHolePlayed = 1 COFFEESCRIPT More human conditionals

Slide 177

Slide 177 text

GolfStatus.Models.Game::PlayingForTypes = brag: 'Bragging Rights' cash: 'Status Cash' GolfStatus.Models.Game::ScoringFormats = low_net: 'Low Net' low_grows: 'Low Gross' COFFEESCRIPT Easy object.prototype

Slide 178

Slide 178 text

noticeHTML =''' ''' noticeHTML += "
#{noticeText}
" noticeHTML += ''' ''' COFFEESCRIPT Heredocs

Slide 179

Slide 179 text

Because string building sucks.

Slide 180

Slide 180 text

And so much more.

Slide 181

Slide 181 text

http://wynn.fm/2Y

Slide 182

Slide 182 text

GET THE BOOK. http://wynn.fm/g8

Slide 183

Slide 183 text

JavaScript Frameworks

Slide 184

Slide 184 text

https://github.com/documentcloud/underscore From Jeremy Ashkenas, the creator of CoffeeScript. https://github.com/documentcloud/backbone

Slide 185

Slide 185 text

QUESTIONS? http://spkr8.com/t/9283