Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

improve css and font; fix link to _why's poignant guide

  • Loading branch information...
commit 51c38f6d9e53ba764151c0c097127233b5951505 1 parent 0af62b5
@alexch alexch authored
View
21 Gemfile.lock
@@ -0,0 +1,21 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ rack (1.3.4)
+ rack-protection (1.1.4)
+ rack
+ rake (0.9.2)
+ rdiscount (1.6.8)
+ sinatra (1.3.1)
+ rack (>= 1.3.4, ~> 1.3)
+ rack-protection (>= 1.1.2, ~> 1.1)
+ tilt (>= 1.3.3, ~> 1.3)
+ tilt (1.3.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ rake
+ rdiscount
+ sinatra
View
32 lessons/03.yaml
@@ -1,11 +1,11 @@
----
+---
content: |
## Other Tools to help you learn Ruby
### ri
-
+
ri is a tool to look up ruby documentation:
-
+
$ ri String.split
= String.split
@@ -18,26 +18,26 @@ content: |
Divides str into substrings based on a delimiter, returning an array of
these substrings.
...
-
+
You can do a lot with it:
-
+
* `ri Class` -- looks up the class documentation and shows all the methods available.
* `ri Class.method` -- looks up a specific method on a class or module.
* `ri method` -- searches all classes for matching methods
-
+
If running ri doesn't work and you've installed ruby using rvm, try
running this command first:
$ rvm docs generate
-
+
### irb
-
+
We've already introduced irb above, but it can't be stressed enough
that having an interactive live session with ruby is invaluable. You
can learn a lot from it.
-
+
Add this to a file called ~/.irbrc:
-
+
<pre class="code">
class Object
def pim inherited = false
@@ -46,21 +46,21 @@ content: |
end
end
</pre>
-
+
Now you can do stuff like:
-
+
$ irb
>> "blah".pim
=> ["%", "*", "+", "<<", "<=>", "[]", "[]=", "bytes", "bytesize", ...]
-
+
All of these methods are available for any string. You can then use
`ri` to look up the method documentation. It is a great way to find goodies!
-
+
### online resources
-
+
* [Ruby Quickref](http://www.zenspider.com/Languages/Ruby/QuickRef.html)
* The Google - searching "ruby" and whatever you're looking for usually leads to good stuff.
* [Ruby Koans](http://rubykoans.com/) - a great set of lessons in an interactive form.
* [Learn to Program by Chris Pine](http://pine.fm/LearnToProgram) - also available as [a book](http://pragprog.com/book/ltp2/learn-to-program).
* [The Pickaxe](http://pragprog.com/book/ruby3/programming-ruby-1-9) - The definitive ruby reference (and has a great tutorial too).
- * [Why's (poignant) Guide to Ruby](http://en.wikipedia.org/wiki/Why's_(poignant)_Guide_to_Ruby) - the (crazy) guide to ruby... Try it, you might like it.
+ * [Why's (poignant) Guide to Ruby](http://www.scribd.com/doc/8545174/whys-Poignant-Guide-to-Ruby) - the (crazy) guide to ruby... Try it, you might like it.
View
BIN  public/css/opensans-bold.woff
Binary file not shown
View
BIN  public/css/opensans-italic.woff
Binary file not shown
View
BIN  public/css/opensans.woff
Binary file not shown
View
49 public/css/railsbridge.css
@@ -1,5 +1,50 @@
-div.top-goal { border: 1px solid black; padding: 1em; margin-bottom: 1em }
-div.content { background: #ccf; border: 1px solid black; padding: 1em; margin: 1em }
+/* @import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,700); */
+
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 400;
+ src: local('Open Sans'), local('OpenSans'), url('opensans.woff') format('woff');
+}
+@font-face {
+ font-family: 'Open Sans';
+ font-style: italic;
+ font-weight: 400;
+ src: local('Open Sans Italic'), local('OpenSans-Italic'), url('opensans-italic.woff') format('woff');
+}
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 700;
+ src: local('Open Sans Bold'), local('OpenSans-Bold'), url('opensans-bold.woff') format('woff');
+}
+
+/***/
+body {
+ font-family: 'Open Sans', helvetica,arial,sans-serif;
+}
+
+div.nav {
+ border: 1px solid blue;
+ padding: .25em;
+ display: inline-block; /* shrink-wrapped */
+ background: #F5F5FF;
+ float: right;
+ margin: .25em;
+}
+
+div.top-goal {
+ border: 1px solid black; padding: 1em; margin-bottom: 1em
+}
+div.content {
+ background: #ccf; border: 1px solid black; padding: 1em; margin: 1em;
+}
+div.main {
+ margin: auto;
+ max-width: 50em;
+}
+
+
div.goal { background: #fcc; padding: 1em; }
div.steps { background: #ffc; padding: 1em; }
div.what { background: #cfc; padding: 1em; }
View
9 railsbridge.rb
@@ -33,6 +33,8 @@ def load_lesson n
lesson["section_content"] ||= ""
lesson["skip_nav"] ||= false
lesson
+ rescue TypeError => e
+ raise "Error loading lesson #{n}"
end
def nav n
@@ -43,7 +45,8 @@ def nav n
r << "<a href=\"/#{befor}\">Prev Lesson</a>" if lesson_path befor
r << "<a href=\"/toc\">TOC</a>"
r << "<a href=\"/#{after}\">Next Lesson</a>" if lesson_path after
- r.join " | "
+ links = r.join(" | ")
+ "<div class='nav'>#{links}</div>"
end
end
@@ -63,6 +66,10 @@ def nav n
}
end
+ get '/favicon.ico' do
+ halt 404
+ end
+
get '/:id' do
n = params[:id].to_i
lesson = load_lesson n
View
4 views/goal.erb
@@ -1,5 +1,7 @@
<%= nav n unless skip_nav %>
+<div class="main">
+
<% if section_title %>
<h2><%= section_title %></h2>
<% end %>
@@ -40,4 +42,6 @@
</div> <!-- top-goal -->
+</div> <!-- main -->
+
<%= nav n unless skip_nav %>
View
3  views/page.erb
@@ -1,5 +1,6 @@
<%= nav n unless skip_nav %>
+<div class="main">
<% if section_title %>
<h2><%= section_title %></h2>
<% end %>
@@ -8,4 +9,6 @@
<%= markdown content %>
</div>
+</div>
+
<%= nav n unless skip_nav %>
View
6 views/toc.erb
@@ -1,3 +1,4 @@
+<div class="toc">
<h2>Table of Contents</h2>
<ol>
@@ -7,8 +8,9 @@
<li><a href="/<%= i+1 %>"><%= lesson["section_title"] %></a>
<ol>
<% end %>
- <% if lesson["goal_title"] then %>
+ <% if lesson["goal_title"] then %>
<li><a href="/<%= i+1 %>"><%= lesson["goal_title"] %></a>
<% end %>
<% end %>
-</ol>
+</ol>
+</div>
Please sign in to comment.
Something went wrong with that request. Please try again.