Permalink
Browse files

Init commit

  • Loading branch information...
bmizerany committed Jan 29, 2009
0 parents commit e1f35d486ec518535377208ccf38d62f0a6bb2f1
Showing with 58 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +29 −0 supermemo.rb
  3. +15 −0 views/c.sass
  4. +9 −0 views/index.haml
@@ -0,0 +1,5 @@
+\#*
+.#*
+.emacs*
+.DS_Store
+*.db
@@ -0,0 +1,29 @@
+require 'rubygems'
+require 'sinatra'
+require 'sequel'
+
+class Hash
+ def slice(*keys)
+ self.inject({}) { |m,(k,v)| m[k] = v if keys.include?(k); m }
+ end
+end
+
+configure do
+ DB = Sequel.connect(ENV["DATABASE_URI"] || "sqlite://dev.db")
+ DB.create_table :entries do
+ column :text, :string
+ end
+end
+
+get '/c.css' do
+ content_type 'text/css'
+ sass :c
+end
+
+get '/' do
+ haml :index
+end
+
+post '/p.js' do
+ DB[:entries] << params.slice(:text)
+end
@@ -0,0 +1,15 @@
+body
+ :color #333
+ :font-family Arial
+ :font-weight bold
+ :margin 20px
+
+#title
+ :font-size 20pt
+ :margin-bottom 20px
+
+input
+ :font-size 16pt
+ :font-family Arial
+ :margin-bottom 20px
+
@@ -0,0 +1,9 @@
+%html
+ %head
+ %link{:rel => 'stylesheet', :href => 'c.css', :type => 'text/css', :media => 'screen'}
+
+#title Super Reader
+%form{:action => '/p', :method => 'POST'}
+ %textarea{:name => 'content', :cols => 50, :rows => 10}
+ %br/
+ %input{:value => 'Submit', :type => :submit}

0 comments on commit e1f35d4

Please sign in to comment.