Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lcapaldo
Created November 13, 2011 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcapaldo/1362872 to your computer and use it in GitHub Desktop.
Save lcapaldo/1362872 to your computer and use it in GitHub Desktop.
My second shoe for two shoes weekend 2: the shoesening
Shoes.app do
@log = []
@entries = stack do
@entry = edit_line
flow do
button("Add text") {
@log << "TXT #{@entry.text}"
@entries.append { title @entry.text }
}
button("Add image") {
@log << "IMG #{@entry.text}"
@entries.append { image @entry.text }
}
button("Save") {
File.open("blog.txt", "w") do |f|
@log.each { |l| f.puts(l) }
end
}
end
filecontents = File.read('blog.txt') rescue nil
if filecontents
filecontents.each_line do |l|
l.chomp!
@log << l
if l =~ /^TXT (.*)/
title $1
elsif l =~ /^IMG (.*)/
image $1
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment