Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
admin
committed
Jun 9, 2008
1 parent
602942a
commit 8d0bfa8
Showing
102 changed files
with
9,351 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
This source tree contains a mixture of original material and other people's work. In particular, | ||
it contains Syntax Highlighting code from http://code.google.com/p/syntaxhighlighter/ and | ||
the S5 package from http://meyerweb.com/eric/tools/s5/. Both of these packages carry their own licenses, | ||
and the conditions in this file do not apply to these packages. | ||
|
||
The following terms apply to the original code in this source tree: | ||
|
||
Copyright (c) 2008 Dave Thomas | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This is a remarkably trivial package that makes simply HTML-based presentations from | ||
a set up source files written using Textile. It's designed to help when creating | ||
slides that contain lots of code, as it allows code to be embedded from external source files. | ||
This means that the code that you embed can come from running (and tested) programs. | ||
|
||
The code in the resulting slides is syntax highlighted, and is hyperlinked to the original | ||
source file, allowing that file to be brought up in Textmate. | ||
|
||
To get started | ||
|
||
* make sure you have Ruby 1.8.6 installed, along with the Rake and redcloth gems | ||
* type 'rake all' in the same directory as this README file | ||
* open html/all.html | ||
|
||
|
||
See the file LICENSE for details on how this all may be used. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
SLIDES_DIR = 'slides/' | ||
HTML_DIR = 'html/' | ||
ALL_HTML = File.join(HTML_DIR, "all.html") | ||
|
||
METADATA = File.join(SLIDES_DIR, "metadata.yml") | ||
|
||
Dir.chdir(SLIDES_DIR) { SRC = FileList['*.slides']; SRC.resolve } | ||
|
||
OUTPUT = [] | ||
|
||
SRC.each do |file_name| | ||
slide_file = File.join(SLIDES_DIR, file_name) | ||
html_file = File.join(HTML_DIR, file_name.ext('.html')) | ||
OUTPUT << html_file | ||
desc "Build #{html_file} from #{slide_file}" | ||
file html_file => [HTML_DIR, slide_file] do | ||
sh "ruby bin/pressie.rb #{METADATA} #{slide_file} > #{html_file}" | ||
end | ||
end | ||
|
||
desc "Build the HTML slides from all the files slides/*.slides files" | ||
task :default => OUTPUT | ||
|
||
desc "Build all slides based on the contents of slides/table_of_contents.slides" | ||
task :all => [ 'tmp/', HTML_DIR, ALL_HTML, :remove_tmp ] | ||
|
||
task ALL_HTML => 'tmp/almost_all.html' do | ||
sh "ruby bin/postprocess_all.rb tmp/almost_all.html >#{ALL_HTML}" | ||
end | ||
|
||
task 'tmp/almost_all.html' => 'tmp/almost_all.slides' do | ||
sh "ruby bin/pressie.rb #{METADATA} tmp/almost_all.slides >tmp/almost_all.html" | ||
end | ||
|
||
task 'tmp/almost_all.slides' => OUTPUT do | ||
sh "ruby bin/build_all.rb #{METADATA} slides/table_of_contents.slides tmp/almost_all.slides" | ||
end | ||
|
||
file "tmp/" do | ||
mkdir "tmp" | ||
end | ||
|
||
file "html/" do | ||
mkdir "html" | ||
end | ||
|
||
task :remove_tmp do | ||
FileUtils.rm_rf("tmp") | ||
end | ||
|
||
desc "Remove all work products—slides and temporary files" | ||
task :clean => :remove_tmp do | ||
FileUtils.rm_rf HTML_DIR | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# We're passed a file containing hyperlinks to the HTML | ||
# (ie, table_con_contents.slides) | ||
# and contruct all.slides from it | ||
require 'yaml' | ||
|
||
def usage(msg = nil) | ||
STDERR.puts "#{__FILE__} metadata contents output" | ||
if msg | ||
STDERR.puts | ||
STDERR.puts msg | ||
end | ||
exit 1 | ||
end | ||
|
||
BASE = File.join(File.dirname(__FILE__), "..") | ||
|
||
metadata_name = ARGV.shift || usage("Missing metadata") | ||
contents_name = ARGV.shift || usage("Missing table of contents file name") | ||
op_name = ARGV.shift || usage("Missing output file name") | ||
|
||
metadata = YAML.load_file(metadata_name) | ||
|
||
contents = File.readlines(contents_name). | ||
grep(/^\*.*:(.*)\.html/) { File.join(BASE, "slides", "#{$1}.slides") }. | ||
map {|name| File.read(name) } | ||
|
||
File.open(op_name, "w") do |op| | ||
|
||
op.puts "h1. #{metadata['title']}\n\n" | ||
op.puts "bq. #{metadata['author']}\n\n" | ||
|
||
op.puts "h1. Contents\n\n" | ||
|
||
op.puts %{<div style="font-size: 70%">\n\n} | ||
|
||
contents.each do |content| | ||
content =~ /h1.\s+(.*)/ | ||
STDERR.puts $1 | ||
op.puts "* #{$1}\n\n" | ||
end | ||
|
||
op.puts "</div>\n\n" | ||
|
||
contents.each do |content| | ||
op.puts content.sub(/h1/, 'h1(slide0)').sub(/__END__.*/m, '') | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
content = File.read(ARGV[0]) | ||
|
||
content = content.gsub(/<div class="slide">\s+<h1 class="slide0"/m, %{<div class="title slide">\n<h1}) | ||
|
||
puts content |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
base = File.join(File.dirname(__FILE__), "..") | ||
$: << File.join(base, "lib") | ||
|
||
require 'rubygems' | ||
require "pressie/pressie" | ||
|
||
Pressie::process |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class TimeMachine | ||
def initialize | ||
time = Time.now | ||
puts time | ||
end | ||
end | ||
TimeMachine.new |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class TimeMachine | ||
def initialize | ||
time = Time.now | ||
end | ||
puts time | ||
#this will cause a NameError | ||
#time_machine.rb:5: | ||
#undefined local variable or method `time' for TimeMachine:Class (NameError) | ||
end | ||
TimeMachine.new |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class TimeMachine | ||
def initialize | ||
@time = Time.now | ||
end | ||
|
||
def show_the_time | ||
puts @time | ||
end | ||
|
||
#this will work but | ||
end | ||
t = TimeMachine.new | ||
t.show_the_time |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class TimeMachine | ||
def initialize | ||
@time = Time.now | ||
end | ||
puts @time | ||
|
||
#this will work but | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class TimeMachine | ||
time = Time.now | ||
puts time | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
#START:basics | ||
|
||
array = [] | ||
# or | ||
array = Array.new | ||
|
||
#END:basics | ||
|
||
#START:add | ||
|
||
arr = [] | ||
arr << 1 | ||
arr << 2 | ||
arr | ||
#=> [1,2] | ||
|
||
#END:add | ||
|
||
#START:remove | ||
|
||
arr = [1,2,3] #this is another way to create and intialize an array | ||
arr | ||
#=> [1,2,3] | ||
arr.delete(1) | ||
arr | ||
#=> [2,3] | ||
|
||
#END:remove | ||
|
||
#START:months | ||
months = %w[Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec] | ||
months.size | ||
#=>12 | ||
#END:months | ||
|
||
|
||
#START:iter_blocks | ||
|
||
months = %w[Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec] | ||
months.each {|month| print month , " "} | ||
#we will talk more about blocks tommorow | ||
|
||
#END:iter_blocks | ||
|
||
#START:array_merge | ||
quarter_1 = [1000,2299,1443] | ||
quarter_2 = [1300,2480,1100] | ||
quarter_3 = [1300,2480,1100] | ||
quarter_4 = [1590,2280,1200] | ||
year = quarter_1 + quarter_2 + quarter_3 + quarter_4 | ||
#END:array_merge | ||
|
||
|
||
#START:iterations | ||
for i in 1..12 do | ||
print months[i] , " " | ||
end | ||
#END:iterartions | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
arr = [] | ||
arr[40] = 1 | ||
|
||
arr[-1] = 20 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#START:simple_block | ||
def sayIntroduction | ||
puts "Hi, my name is Yoni." | ||
end | ||
3.times { sayIntroduction } | ||
#END:simple_block | ||
|
||
#START:method_blocks | ||
def do_ten_times | ||
if block_given? | ||
10.times{|i| yield(i)} | ||
else | ||
puts "no block given" | ||
end | ||
end | ||
|
||
do_ten_times | ||
# no block given | ||
|
||
do_ten_times {|i| (1..i).each {print '*'}; puts("")} | ||
|
||
#END:method_blocks | ||
|
||
#START:task | ||
|
||
#END:task |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.times { print "Good morning; " } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
course_1 = 90 | ||
course_2 = 80 | ||
course_3 = 87 | ||
course_4 = 95 | ||
|
||
avarage = (course_1 + course_2 + course_3 + course_4) / 4 | ||
puts avarage |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
courses = [] | ||
courses[0] = 90 | ||
courses[1] = 80 | ||
courses[2] = 87 | ||
courses[3] = 95 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
courses = [] | ||
courses[0] = 90 | ||
courses[1] = 80 | ||
courses[2] = 87 | ||
courses[3] = 95 | ||
|
||
courses.sort | ||
courses << 100 | ||
courses << 62 | ||
puts courses |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#START:person_hash | ||
def print_person( person = {}) | ||
print "#{person["title"]} #{person["first_name"]} #{person["last_name"]} lives in #{person["city"]}" | ||
end | ||
|
||
person = Hash.new | ||
person["last_name"] = "Adam" | ||
person["first_name"] = "Zvi" | ||
person["title"] = "Dr." | ||
person["city"] = "Hertzliya" | ||
#END:person_hash | ||
|
||
#START:hash_keys | ||
person = {"last_name" => "Adam", | ||
"first_name" => "Zvi", | ||
"title" => "Dr.", | ||
"city" => "Hertzliya"} | ||
person.keys | ||
#=> ["city", "title", "first_name", "last_name"] | ||
person.values | ||
#=> ["Hertzliya", "Dr.", "Zvi", "Adam"] | ||
#END:hash_keys |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] | ||
months.size | ||
#=>12 |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
def open_box(continuation) | ||
continuation.call if rand < 0.5 | ||
end | ||
|
||
callcc do |continuation| | ||
puts "opening box" | ||
open_box(continuation) | ||
puts "Phew--kitty's OK" | ||
end | ||
|
||
puts "closing box" |
Oops, something went wrong.