 (defn now [] (java.sql.Timestamp. (.getTime (java.util.Date.))))
 
 (defn create-instapapure-tables []
-  (create-table :posts   
+  (create-table :posts
     [:id :int "IDENTITY" "PRIMARY KEY"]
     [:location :varchar "NOT NULL"]
     [:title :varchar "NOT NULL"]
     [:created_at :datetime]))
 
-;; we put the table creation in a try. 
+;; we put the table creation in a try.
 ;; All calls after the 1st one will fail because the table is already there
 (try
   (with-connection db (create-instapapure-tables))
   (catch Exception _))
 
-(defn insert-post [location title] 
+(defn insert-post [location title]
   (with-connection db
     (transaction
       (insert-values :posts
         [:location :title :created_at]
         [ location   title  (now)]))))
-        
+
 (defn select-posts []
   (with-connection db
     (with-query-results res ["select * from posts"] (doall res))))

      [:h1 title]
      body]))

(defn display-post [post] 
  [:li 
    [:span "(" (:id post) ") "]
    [:a {:href (:location post)} (:title post)]
    [:div " created at " (:created_at post)]])
    
(defn show-posts []
  (layout "All Posts"
    (html

        (map display-post (select-posts))]
      [:a {:href "/post"} "New Post"]
      [:p "Drag the bookmarklet: "
        [:a {:href bookmarklet} "Read later"]])))

(defn new-post [location title]
  (insert-post location title)
