Create a gist now

Instantly share code, notes, and snippets.

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