Skip to content

Instantly share code, notes, and snippets.

@siraskalot
Created August 15, 2012 02:32
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 siraskalot/3355090 to your computer and use it in GitHub Desktop.
Save siraskalot/3355090 to your computer and use it in GitHub Desktop.
require 'sinatra'
get '/' do
erb :index
end
post '/' do
post_title = params[:post_title]
file_name = post_title.gsub! '\s+', '_'
File.open(file_name, 'w') do |f|
f.write params[:post_title]
f.write "\n---\n\n"
f.write params[:post_text]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment