Skip to content

Commit 7f83139

Browse files
committed
updating week 5 with code for the board, adding favicon, fixing page breaks on print.css
1 parent 6cccbe7 commit 7f83139

File tree

4 files changed

+133
-10
lines changed

4 files changed

+133
-10
lines changed

_layouts/page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
---
44
<article>
5-
<h2><a href="{{ page.url }}">
5+
<h2 class="alpha"><a href="{{ page.url }}">
66
{{ page.title }}
77
</a></h2>
88
{{ content }}

exercises/week5.md

+116-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
---
22
layout: page
33
body_classes: exercise
4+
title: Week 5 &mdash; Overview
45
---
56

6-
## Week 5 &mdash; Overview
77
### Monday Stuff
88
* Announcements
99
* Network points awards
1010
* Networking events for the week
1111
* Call for lightning talks
1212

1313
### Monday comprehension questions
14+
* What's an API server
15+
* What's an API
16+
* What's REST
17+
* What's Sinatra
1418

1519
### Weekly Topics
1620
* Sinatra Basics
@@ -19,9 +23,11 @@ body_classes: exercise
1923
* jQuery & Coffeescript
2024

2125
### Weekly Theme
26+
Building a chat room with long-polling, jquery, and a database backend
2227

2328
### Weekly Home<del>work</del>**fun**
2429
* Email me a link to your 5th Blog post. 1-2 pages (500-1000 words) about your week, what you learned, something funny that happened or something about the technologies we talked about.
30+
* Email me a link to your group's project.
2531

2632
## Monday &mdash; 3/4/2013
2733
### Topics
@@ -57,16 +63,31 @@ sinatra-gen sinatra-long-poll --tiny --test=spec --views=erb get:/subscribe post
5763
RACK_ENV=development be ruby sinatra-long-poll.rb
5864
{% endhighlight %}
5965

66+
### Code for the board
6067
{% highlight ruby %}
68+
# Routing
69+
get '/'
70+
get '/:id' do
71+
# params[:id]
72+
get '/:id' do |id|
73+
# id
74+
get '/users/*'
75+
# params[:splat]
76+
77+
# Templates and processing
6178
require 'erb'
62-
# Compile the template (but don't fill in the values yet)
6379
template = ERB.new "The value of x is: <%= @x %>"
64-
65-
# Prepare the values for inclusion in ERB
6680
@x = 42
67-
68-
# Use the variables in the current scope and pass them to `result`
69-
puts template.result(binding) #=> The value of x is: 42
81+
template.result(binding) #=> The value of x is: 42
82+
83+
# Sass / Coffee compilation
84+
get '/css/pages.css' do
85+
sass :pages # ./views/pages.scss
86+
end
87+
get '/js/application.js' do
88+
# requires execjs or therubyracer
89+
coffee :application # ./views/application.coffee
90+
end
7091
{% endhighlight %}
7192

7293
### Exercises
@@ -122,6 +143,31 @@ puts template.result(binding) #=> The value of x is: 42
122143
* [Object-oriented Design](http://en.wikipedia.org/wiki/Object-Oriented_Programming#Fundamental_features_and_concepts)
123144
* [Responsibility-driven Design](http://en.wikipedia.org/wiki/Responsibility-driven_design)
124145

146+
### Code for the board
147+
{% highlight text %}
148+
Client:
149+
Responsibilities:
150+
Request websites from webserver using ip
151+
Request ip from DNS
152+
Collaborators:
153+
DNSServer
154+
WebServer
155+
156+
DNSServer
157+
Responsibilities:
158+
Translate domains to ip addresses
159+
Collaborators:
160+
Client
161+
UpstreamDNSServer { ... snip }
162+
163+
WebServer
164+
Responsibilities:
165+
Serve HTML to people who ask nicely
166+
Collaborators:
167+
FileSystem { ... snip }
168+
AppServers { ... snip }
169+
{% endhighlight %}
170+
125171
### Exercises
126172

127173
#### Stage 0
@@ -189,6 +235,19 @@ puts template.result(binding) #=> The value of x is: 42
189235
* [Object-relational impedance mismatch](http://en.wikipedia.org/wiki/Object-Relational_impedance_mismatch)
190236
* [Database Normalization (Wikipedia)](http://en.wikipedia.org/wiki/Database_normalization)
191237

238+
### Code for the board
239+
{% highlight sql %}
240+
# Normal select with a where
241+
SELECT * FROM songs WHERE play_count > 2000000;
242+
243+
# Equivalent Join statements (old vs new school)
244+
# Note the naming and talk about normalization
245+
SELECT * FROM songs
246+
LEFT JOIN artists ON song.artist_id = artists.id;
247+
SELECT * FROM songs, artists
248+
WHERE song.artist_id = artists.id
249+
{% endhighlight %}
250+
192251
### Exercises
193252

194253
#### Stage 1 (remembering/understanding)
@@ -222,31 +281,79 @@ puts template.result(binding) #=> The value of x is: 42
222281
## Thursday &mdash; 3/7/2013
223282
### Topics
224283
* jQuery and Coffeescript
284+
* Document ready
285+
* CDN vs self-hosted
286+
* Selecting elements
287+
* Add/remove classes, show/hide
288+
* Callbacks/handlers
225289

226290
### Goals
227291
* Learn the important bits about jQuery
228292
* Get coffeescript compiling in Sinatra
229293

230294
### Important Threshold Concepts
295+
* Callbacks
231296

232297
### Reading to do before class
298+
* [Small intro to jQuery](http://learn.jquery.com/about-jquery/how-jquery-works/)
299+
* [Outstanding slides by John Resig himself (up to slide 29ish)](http://ejohn.org/apps/workshop/intro)
300+
* [Video about jQuery (old but relevant)](http://css-tricks.com/video-screencasts/20-introduction-to-jquery/)
233301

234302
### Resources
303+
* [jQuery homepage](http://jquery.com/)
304+
* [jQuery API Docs](http://api.jquery.com/)
305+
* [CoffeeScript Docs](http://coffeescript.org/)
306+
* [CoffeeScript + Sinatra](http://recipes.sinatrarb.com/p/views/coffee_script)
307+
308+
### Code for the board
309+
{% highlight javascript %}
310+
// Naming conventions for wrapped sets
311+
$buttons = $("button")
312+
313+
// DOMReady
314+
$(document).readyfunction () {});
315+
$().ready(function () {}); // Not recommended
316+
$(function () {});
317+
jQuery(document).ready(function ($) {}); // $.noConflict() mode
318+
$ -> // in CoffeeScript
319+
320+
// Click handlers
321+
$('.toggle-all').on 'click', (e) ->
322+
$('.collapsable').slideToggle()
235323

236-
### Helpful Commands
237-
{% highlight bash %}
238324
{% endhighlight %}
239325

240326
### Exercises
241327

242328
#### Stage 1 (remembering/understanding)
243329

244330
* Answer these questions with your group
331+
* Why do we have to wait until document.ready
332+
* What is the condensed form of domready
333+
* How do you select elements with jQuery
334+
* Why should we use the CDN version of jQuery
335+
* Why should we not use the CDN version of jQuery
336+
* How do you add a class in jquery? How do you hide/show
337+
* How do you chain methods in jquery
338+
* How do you add a click handler or a submit handler
339+
* How do you overwrite what's in an element
340+
* How do you append to the content in an element
245341

246342
#### Stage 2 (application/analyzing)
247343

344+
* With your group, using your chat app, have the new chat messages slide in instead of appearing
345+
* When you click on a username, make it appear in the text field with an @ next to it
346+
* If an @yourusername appears, make it bold and colorful
347+
* If an image url comes into the page, display it
348+
* Give each line of chat a different colored background so it's easy to read
349+
* Give each user their own colored background
350+
* If you click on an image, collapse it and hide it
351+
248352
#### Boss Fight (evaluation/creation)
249353

354+
* Display gravatars next to each chat message (you'll have to use emails instead of usernames)
355+
* Research jQuery-UI and see what's available there. Write up some options on the board.
356+
250357
## Friday &mdash; 3/8/2013
251358
* Wrapping it all up
252359
* Retrospective

favicon.ico

16.6 KB
Binary file not shown.

stylesheets/print.css

+16
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,20 @@
3939
.confidence .smiley {
4040
width: 30px;
4141
}
42+
.page-break {
43+
page-break-after: always;
44+
}
45+
.exercise h2 {
46+
page-break-before: always;
47+
}
48+
.exercise h2.alpha {
49+
page-break-before: avoid;
50+
margin: 0 0 10px;
51+
font-size: 24px;
52+
}
53+
.exercise h2.alpha a {
54+
text-decoration: none;
55+
color: #393939;
56+
font-weight: bolder;
57+
}
4258
}

0 commit comments

Comments
 (0)