<commit_before>(ns foreclojure.utils
  (:use (hiccup [core :only [html]]
                [page-helpers :only [doctype include-css]]))
  (:require [sandbar.stateful-session :as session]
            (ring.util [response :as response])))

(defmacro dbg[x] `(let [x# ~x] (println '~x "=" x#) x#))

(defn flash-error [msg url]
  (do (session/flash-put! :error msg)
      (response/redirect url)))

(defn flash-msg [msg url]
  (do (session/flash-put! :message msg)
      (response/redirect url)))

(defmacro def-page [page-name [& args] & code]
  `(defn ~page-name [~@args]
     (html-doc
      ~@code)))

(defn row-class [x]
  {:class (if (zero? (mod x 2))
            "evenrow"
            "oddrow")})
  
(defn html-doc [& body] 
  (html 
   (doctype :html5)
   [:html 
    [:head 
     [:title "4Clojure"]
     (include-css "/style.css")]
    [:body <commit_msg>(zero? (mod x 2)) == (even? x)<commit_after>(ns foreclojure.utils
  (:use (hiccup [core :only [html]]
                [page-helpers :only [doctype include-css]]))
  (:require [sandbar.stateful-session :as session]
            (ring.util [response :as response])))

(defmacro dbg[x] `(let [x# ~x] (println '~x "=" x#) x#))

(defn flash-error [msg url]
  (do (session/flash-put! :error msg)
      (response/redirect url)))

(defn flash-msg [msg url]
  (do (session/flash-put! :message msg)
      (response/redirect url)))

(defmacro def-page [page-name [& args] & code]
  `(defn ~page-name [~@args]
     (html-doc
      ~@code)))

(defn row-class [x]
  {:class (if (even? x)
            "evenrow"
            "oddrow")})
  
(defn html-doc [& body] 
  (html 
   (doctype :html5)
   [:html 
    [:head 
     [:title "4Clojure"]
     (include-css "/style.css")]
    [:body 
{'fraction_non_alphanumeric': 0.1899247249565721, 'fraction_numerical': 0.003474232773595831, 'mean_word_length': 2.653276955602537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4521717', 'n_tokens_mistral': 689, 'n_tokens_neox': 653, 'n_words': 167}