Slide Show Demo

A wiki page — and a slide show too?

Just export this page as Slidy (in the sidebar). Or click here to view it as a slide show now.

Second slide: A list

1qasfdf

  • one
  • twoㄴ
  • buckle my shoe

Third slide: An image

sdf What do we think about French cheeses?

Fourth slide: some (poignant) ruby

 require 'wordlist'

# Get evil idea and swap in code words
print "Enter your new idea: "
idea = gets
code_words.each do |real, code|
idea.gsub!( real, code )
end

# Save the jibberish to a new file
print "File encoded. Please enter a name for this idea: "
idea_name = gets.strip
File::open( "idea-" + idea_name + ".txt", "w" ) do |f|
f << idea
end

Fifth slide: No, Learn You a Haskell

import System.IO
main = do
handle <- openFile "girlfriend.txt" ReadMode
contents <- hGetContents handle
putStr contents
hClose handle

Running it, we get the expected result:

$ runhaskell girlfriend.hs  
Hey! Hey! You! You!
I don't like your girlfriend!
No way! No way!
I think you need a new one!

Seventh Slide … for Great Good

-- Let's use a fold to implement searching a list for a sublist.              
search :: (Eq a) => [a] -> [a] -> Bool
search needle haystack = foldl length_test False (tails haystack)
where length_test bool x =
if take needle_length x == needle then True else bool
needle_length = length needle

declaration :: String
declaration = "We hold these truths to be self-evident, " ++
"that all men are created equal"

Here we get the result:

ghci> search "elf" declaration
True
ghci> search "eat" declaration
True

Eighth Slide: some math?

With some inline: a=1π, and some displayed:

s=ateπ

Doesn’t work yet in the S5 slide show, only plain webpages — need to add a link to jsMath!

Credits

Thanks for random snippets to

Why’s (poignant) guide to ruby

and

Learn You a Haskell for Great Good!