Permalink
Browse files

adding files

  • Loading branch information...
1 parent 602942a commit 8d0bfa8caa8861402159717dfe99ed4dbfde1286 admin committed Jun 9, 2008
Showing with 9,351 additions and 0 deletions.
  1. +29 −0 LICENSE
  2. +17 −0 README
  3. +54 −0 Rakefile
  4. +47 −0 bin/build_all.rb
  5. +5 −0 bin/postprocess_all.rb
  6. +7 −0 bin/pressie.rb
  7. +7 −0 code/Examples/day_1/time_machine_1.rb
  8. +10 −0 code/Examples/day_1/time_machine_2.rb
  9. +13 −0 code/Examples/day_1/time_machine_3.rb
  10. +8 −0 code/Examples/day_1/time_machine_4.rb
  11. +5 −0 code/Examples/day_1/time_machine_5.rb
  12. +61 −0 code/Examples/day_2/array_basics.rb
  13. +4 −0 code/Examples/day_2/array_example_1.rb
  14. +26 −0 code/Examples/day_2/block_simple.rb
  15. +1 −0 code/Examples/day_2/course_0.rb
  16. +7 −0 code/Examples/day_2/course_1.rb
  17. +5 −0 code/Examples/day_2/course_2.rb
  18. +10 −0 code/Examples/day_2/course_3.rb
  19. +22 −0 code/Examples/day_2/hash_basics.rb
  20. +3 −0 code/Examples/day_2/months.rb
  21. 0 code/Examples/day_2/symboles.rb
  22. +11 −0 code/control/basic_continuation.rb
  23. +59 −0 code/control/cc_throw_catch.rb
  24. +8 −0 code/control/closure_continuation.rb
  25. +12 −0 code/control/closure_continuation_2.rb
  26. +115 −0 dp.SyntaxHighlighter/CSS.html
  27. +134 −0 dp.SyntaxHighlighter/CSharp.html
  28. +90 −0 dp.SyntaxHighlighter/CollapseCode.html
  29. +190 −0 dp.SyntaxHighlighter/Cpp.html
  30. +108 −0 dp.SyntaxHighlighter/CrashTest.html
  31. +112 −0 dp.SyntaxHighlighter/Delphi.html
  32. +90 −0 dp.SyntaxHighlighter/FirstLine.html
  33. +80 −0 dp.SyntaxHighlighter/Index.html
  34. +122 −0 dp.SyntaxHighlighter/Java.html
  35. +112 −0 dp.SyntaxHighlighter/JavaScript.html
  36. +89 −0 dp.SyntaxHighlighter/NoControls.html
  37. +89 −0 dp.SyntaxHighlighter/NoGutter.html
  38. +102 −0 dp.SyntaxHighlighter/PHP.html
  39. +121 −0 dp.SyntaxHighlighter/Python.html
  40. +131 −0 dp.SyntaxHighlighter/Ruby.html
  41. +98 −0 dp.SyntaxHighlighter/SQL.html
  42. BIN dp.SyntaxHighlighter/Scripts/clipboard.swf
  43. +32 −0 dp.SyntaxHighlighter/Scripts/shBrushCSharp.js
  44. +73 −0 dp.SyntaxHighlighter/Scripts/shBrushCpp.js
  45. +52 −0 dp.SyntaxHighlighter/Scripts/shBrushCss.js
  46. +34 −0 dp.SyntaxHighlighter/Scripts/shBrushDelphi.js
  47. +22 −0 dp.SyntaxHighlighter/Scripts/shBrushJScript.js
  48. +28 −0 dp.SyntaxHighlighter/Scripts/shBrushJava.js
  49. +60 −0 dp.SyntaxHighlighter/Scripts/shBrushPhp.js
  50. +30 −0 dp.SyntaxHighlighter/Scripts/shBrushPython.js
  51. +28 −0 dp.SyntaxHighlighter/Scripts/shBrushRuby.js
  52. +42 −0 dp.SyntaxHighlighter/Scripts/shBrushSql.js
  53. +29 −0 dp.SyntaxHighlighter/Scripts/shBrushVb.js
  54. +70 −0 dp.SyntaxHighlighter/Scripts/shBrushXml.js
  55. +414 −0 dp.SyntaxHighlighter/Scripts/shCore.js
  56. +674 −0 dp.SyntaxHighlighter/Scripts/shCore.uncompressed.js
  57. +89 −0 dp.SyntaxHighlighter/ShowColumns.html
  58. +88 −0 dp.SyntaxHighlighter/SmartTabs.html
  59. +158 −0 dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css
  60. +63 −0 dp.SyntaxHighlighter/Styles/TestPages.css
  61. +80 −0 dp.SyntaxHighlighter/Templates/Test.dwt
  62. +115 −0 dp.SyntaxHighlighter/VB.html
  63. +136 −0 dp.SyntaxHighlighter/XML.html
  64. BIN html.zip
  65. +968 −0 html/all.html
  66. +110 −0 html/building.html
  67. +433 −0 html/day_1.html
  68. +449 −0 html/day_2.html
  69. +59 −0 html/day_3.html
  70. +59 −0 html/day_4.html
  71. +59 −0 html/day_5.html
  72. +319 −0 html/example.html
  73. +203 −0 html/including_code.html
  74. +156 −0 html/outline.html
  75. +71 −0 html/table_of_contents.html
  76. +160 −0 lib/pressie/content.rb
  77. +106 −0 lib/pressie/pressie.rb
  78. +196 −0 lib/stylesheets/pressie.css
  79. +149 −0 lib/stylesheets/print.css
  80. BIN lib/stylesheets/ruby.png
  81. +27 −0 slides/building.slides
  82. +169 −0 slides/day_1.slides
  83. +165 −0 slides/day_2.slides
  84. 0 slides/day_3.slides
  85. 0 slides/day_4.slides
  86. 0 slides/day_5.slides
  87. +80 −0 slides/example.slides
  88. +80 −0 slides/including_code.slides
  89. +4 −0 slides/metadata.yml
  90. +51 −0 slides/outline.slides
  91. +8 −0 slides/table_of_contents.slides
  92. BIN ui/default/blank.gif
  93. BIN ui/default/bodybg.gif
  94. +23 −0 ui/default/framing.css
  95. +42 −0 ui/default/iepngfix.htc
  96. +7 −0 ui/default/opera.css
  97. +15 −0 ui/default/outline.css
  98. +86 −0 ui/default/pretty.css
  99. +1 −0 ui/default/print.css
  100. +9 −0 ui/default/s5-core.css
  101. +3 −0 ui/default/slides.css
  102. +553 −0 ui/default/slides.js
View
29 LICENSE
@@ -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.
View
17 README
@@ -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.
+
View
@@ -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
View
@@ -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
View
@@ -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
View
@@ -0,0 +1,7 @@
+base = File.join(File.dirname(__FILE__), "..")
+$: << File.join(base, "lib")
+
+require 'rubygems'
+require "pressie/pressie"
+
+Pressie::process
@@ -0,0 +1,7 @@
+class TimeMachine
+ def initialize
+ time = Time.now
+ puts time
+ end
+end
+TimeMachine.new
@@ -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
@@ -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
@@ -0,0 +1,8 @@
+class TimeMachine
+ def initialize
+ @time = Time.now
+ end
+ puts @time
+
+ #this will work but
+end
@@ -0,0 +1,5 @@
+class TimeMachine
+ time = Time.now
+ puts time
+end
+
@@ -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
+
+
@@ -0,0 +1,4 @@
+arr = []
+arr[40] = 1
+
+arr[-1] = 20
@@ -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
@@ -0,0 +1 @@
+3.times { print "Good morning; " }
@@ -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
@@ -0,0 +1,5 @@
+courses = []
+courses[0] = 90
+courses[1] = 80
+courses[2] = 87
+courses[3] = 95
@@ -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
@@ -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
@@ -0,0 +1,3 @@
+months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
+months.size
+#=>12
No changes.
@@ -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.

0 comments on commit 8d0bfa8

Please sign in to comment.