<commit_before>(ns ts-layout.core
  (:require [compojure.core :refer :all]
            [compojure.coercions :refer :all]
            [compojure.route :as route] 
            [ring.util.response :as rr]
            [ring.util.codec :as rc]
            [org.httpkit.server :as hk]
            [ts-layout.model :as m]
            [ts-layout.views :as v]))

(def boxes (atom ["/1" "/2"]))

(defn persist! [val]
  (reset! boxes val))

(defn reload []
  (rr/redirect "/boxes"))

(defroutes app
  (context "/boxes/:index" [index :<< as-int]
           (GET "/up" [] (do 
                           (persist! (m/push-box-up @boxes index))
                           (reload)))
           (GET "/down" [] (do 
                             (persist! (m/push-box-down @boxes index))
                             (reload)))
           (GET "/delete" [] (do
                               (persist!  (m/delete-box @boxes index))
                              (reload))))
  (POST "/boxes/add" {body :body} (persist! (m/add-box @boxes (get (rc/form-decode (slurp body)) "url")))
        (reload))
  (GET "/boxes" []  (v/page (map-indexed v/draw-box @boxes)))
  (GET "/:number" [number :<< as-int]
       (v/numero number))
  (GET "/" [] (rr/redirect "/boxes"))
  (route/not-found (v/missing)))

(defonce server (atom nil))

(def port (atom 8888))

(defonce server (atom nil))
<commit_msg>Adding things works<commit_after>(ns ts-layout.core
  (:require [compojure.core :refer :all]
            [compojure.coercions :refer :all]
            [compojure.route :as route] 
            [ring.util.response :as rr]
            [ring.util.codec :as rc]
            [org.httpkit.server :as hk]
            [ts-layout.model :as m]
            [ts-layout.views :as v]))

(def boxes (atom ["/1" "/2"]))

(defn persist! [val]
  (reset! boxes val))

(defn reload []
  (rr/redirect "/boxes"))

(defn get-form-param [body param]
  (get (rc/form-decode body) param))

(defroutes app
  (context "/boxes/:index" [index :<< as-int]
           (GET "/up" [] (do 
                           (persist! (m/push-box-up @boxes index))
                           (reload)))
           (GET "/down" [] (do 
                             (persist! (m/push-box-down @boxes index))
                             (reload)))
           (GET "/delete" [] (do
                               (persist!  (m/delete-box @boxes index))
                              (reload))))
  (POST "/boxes/add"
        {body-stream :body} (let [body (slurp body-stream)]
                              (persist!
                               (m/add-box @boxes (get-form-param body "url"))))
        (reload))
  (GET "/boxes" []  (v/page (map-indexed v/draw-box @boxes)))
  (GET "/:number" [number :<< as-int]
       (v/numero number))
  (GET "/" [] (rr/redirect "/boxes"))
  (route/not-found (v/missing)))

(defonce server (atom nil))

(def port (atom 8888))

(defonce server (atom nil))

{'fraction_non_alphanumeric': 0.17334703665638918, 'fraction_numerical': 0.0041109969167523125, 'mean_word_length': 1.623539982030548, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3478013', 'n_tokens_mistral': 979, 'n_tokens_neox': 961, 'n_words': 240}