<commit_before>(ns clojuredocs.pages.intro
  (:require [clojuredocs.config :as config]
            [clojuredocs.util :as util]
            [compojure.core :refer (defroutes GET POST)]
            [somnium.congomongo :as mon]
            [fogus.unk :refer (memo-ttl)]
            [clojuredocs.pages.common :as common]
            [clojuredocs.syntax :as syntax]
            [clojuredocs.pages.jobs :as jobs]))

(defmulti $render-recently-updated :type)

(defmethod $render-recently-updated :default [_] nil)

(defmethod $render-recently-updated :example
  [{:keys [var author created-at]}]
  [:div.recently-updated
   (util/$avatar author)
   [:span.content
    (:login author)
    " authored an example for "
    (util/$var-link (:ns var) (:name var)
      (-> var :ns util/html-encode)
      "/"
      (-> var :name util/html-encode))
    " "
    (util/timeago created-at)
    " ago."
    [:div.clear]]])

(defmethod $render-recently-updated :see-also
  [{:keys [from-var to-var author created-at]}]
  [:div.recently-updated
   (util/$avatar author)
   [:span.content
    (:login author)
    " added a see-also from "
    (util/$var-link (:ns from-var) (:name from-var)
      (-> from-var :ns util/html-encode)
      "/"
      (-> from-var :name util/html-encode))
    " to "
    (util/$var-link (:ns to-var) (:name to-var)
      (-> to-var :ns util/html-encode)
      "/"
      (-> to-var :name util/html-encode))
    " "
    (util/timeago created-at)
    " ago."
    [:div.clear]]])

(defmethod $render-recently-updated :note
  [{:keys [var author created-at]}]
  [:div.recently-updated
   (util/$avatar author)
   [:span.content
    (:login author)
    " authored a note for "
    (util/$var-link (:ns var) (:name var)
      (-> var :ns util/html-encode)
      "/"
      (-> var :name util/html-encode))
    " "
    (util/timeago created-at)
    " ago."]
   [:div.clear]])

(defn $job-preview [{:keys [job-title
                            company-name
                            company-image-url
                            short-id
                            job-location
                            remote-ok?
                            comp-cash
                            comp-equity]
                     :as job}]
  [:div.job-preview
   {:style "background-color:#fafafa;padding:5px"}
   #_[:img {:src company-image-url
            :style "max-width:17px;max-height:17px;margin-top:-2px"}]
   #_[:span {:style "margin-right:5px"}]
   (->> [[:span.job-title [:a {:href (str "/jobs/"
                                          short-id
                                          "/"
                                          (jobs/job-slug job))} job-title]]
         [:span.company-name
          {:style "font-weight:bold;"}
          company-name]
         (when job-location
           [:span.job-location
            {:style "color:#888;font-weight:normal"}
            [:i.fa.fa-map-marker
             {:style "margin-right:5px"}]
            job-location])
         (when comp-cash
           [:span.comp-cash (jobs/currency-range comp-cash)])
         (when comp-equity
           [:span.comp-equity (jobs/equity-range comp-equity)])
         (when remote-ok?
           [:span.remote-ok
            {:style "color:#888"}
            [:i.fa.fa-globe
             {:style "margin-right:5px"}]
            "Remote"])]
        (remove nil?)
        (interpose [:span " ∙ "]))])

(defn $jobs-preview [jobs]
  [:div.jobs-preview
   [:div.row
    [:div.col-md-12
     [:h5 "Featured Jobs"]]]
   [:div.row
    [:div.col-md-12
     (->> jobs
          (map $job-preview))]]
   [:div.row
    [:div.col-md-12.text-right
     [:a {:style "font-size:12px"
          :href "/jobs"} "More Clojure Jobs"]]]])

(defn $index [top-contribs recently-updateds]
  [:div
   [:div.row
    [:div.col-md-12
     [:section
      [:h1 "ClojureDocs is a community-powered documentation and examples repository for the " [:a {:href "http://clojure.org"} "Clojure programming language"] "."]]
     [:section
      [:div.search-widget
       [:form.search {:method :get :action "/search" :autocomplete "off"}
        [:input.form-control.placeholder
         {:type "text"
          :name "query"
          :placeholder "Looking for?"
          :autoFocus "autofocus"
          :autoComplete "off"}]
        [:ul.ac-results]]]]]]
   [:div.row
    [:div.col-md-12
     [:section
      [:h5 "Top Contributors"]
      [:div.top-contribs
       (if-not (empty? top-contribs)
         (map util/$avatar top-contribs)
         [:div.null-state "Uh-oh, no contributors!"])
       [:div.migrate-account
        [:a {:href "/migrate-account"} "Migrate your old ClojureDocs account"]]]]
     [:section
      ($jobs-preview (take 3 jobs/DATA))]
     [:section
      [:h5 "Recently Updated"]
      [:div.row
       (->> recently-updateds
            (map $render-recently-updated)
            (partition-all 3)
            (map (fn [rs]
                   [:div.col-sm-6 rs])))]]]]
   [:section
    [:div.row
     [:div.col-md-12
      [:h5 "On Clojure"]]
     [:div.col-md-6
      [:p "Clojure is a concise, powerful, and performant general-purpose programming language that runs on the JVM, CLR, Node.js, and modern mobile and desktop web browsers."]
      [:p
       "New to Clojure and not sure where to start? Here are a few good resources to get you off on the right foot:"]
      [:ul.getting-started-resources
       [:li [:a {:href "https://changelog.com/posts/rich-hickeys-greatest-hits/"} "<NAME>'s Greatest Hits (videos)"]]
       [:li [:a {:href "http://www.braveclojure.com"} "Clojure for the Brave and True"]]
       [:li [:a {:href "http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome"}
             "Clojure from the Ground Up"]]
       [:li [:a {:href "http://tryclj.com"} "Try Clojure (in your browser)"]]
       [:li [:a {:href "http://clojurescriptkoans.com/"} "ClojureScript Koans"]]
       [:li [:a {:href "http://4clojure.org"} "4Clojure (learn Clojure interactively)"]]]
      [:p "There's no denying that Clojure is just so "
       " *different* "
       " from what most of us are used to (what is up with all those parentheses?!), "
       "so it's no surprise that it"
       " takes a bit to get your head around it. Stick with it, and you won't be disappointed."]
      [:p "But don't take our word for it, here's what XKCD has to say:"]
      [:p [:img.xkcd {:src "/img/lisp_cycles.png"}]]
      [:p "Seems like more than a few these days. Happy coding!"]]
     [:div.col-md-6
      [:div.example-code
       (-> "src/examples/clj/first.clj"
           slurp
           (syntax/syntaxify :stringify-style? true))]]]]<commit_msg>Point live browser clojure to repl.it<commit_after>(ns clojuredocs.pages.intro
  (:require [clojuredocs.config :as config]
            [clojuredocs.util :as util]
            [compojure.core :refer (defroutes GET POST)]
            [somnium.congomongo :as mon]
            [fogus.unk :refer (memo-ttl)]
            [clojuredocs.pages.common :as common]
            [clojuredocs.syntax :as syntax]
            [clojuredocs.pages.jobs :as jobs]))

(defmulti $render-recently-updated :type)

(defmethod $render-recently-updated :default [_] nil)

(defmethod $render-recently-updated :example
  [{:keys [var author created-at]}]
  [:div.recently-updated
   (util/$avatar author)
   [:span.content
    (:login author)
    " authored an example for "
    (util/$var-link (:ns var) (:name var)
      (-> var :ns util/html-encode)
      "/"
      (-> var :name util/html-encode))
    " "
    (util/timeago created-at)
    " ago."
    [:div.clear]]])

(defmethod $render-recently-updated :see-also
  [{:keys [from-var to-var author created-at]}]
  [:div.recently-updated
   (util/$avatar author)
   [:span.content
    (:login author)
    " added a see-also from "
    (util/$var-link (:ns from-var) (:name from-var)
      (-> from-var :ns util/html-encode)
      "/"
      (-> from-var :name util/html-encode))
    " to "
    (util/$var-link (:ns to-var) (:name to-var)
      (-> to-var :ns util/html-encode)
      "/"
      (-> to-var :name util/html-encode))
    " "
    (util/timeago created-at)
    " ago."
    [:div.clear]]])

(defmethod $render-recently-updated :note
  [{:keys [var author created-at]}]
  [:div.recently-updated
   (util/$avatar author)
   [:span.content
    (:login author)
    " authored a note for "
    (util/$var-link (:ns var) (:name var)
      (-> var :ns util/html-encode)
      "/"
      (-> var :name util/html-encode))
    " "
    (util/timeago created-at)
    " ago."]
   [:div.clear]])

(defn $job-preview [{:keys [job-title
                            company-name
                            company-image-url
                            short-id
                            job-location
                            remote-ok?
                            comp-cash
                            comp-equity]
                     :as job}]
  [:div.job-preview
   {:style "background-color:#fafafa;padding:5px"}
   #_[:img {:src company-image-url
            :style "max-width:17px;max-height:17px;margin-top:-2px"}]
   #_[:span {:style "margin-right:5px"}]
   (->> [[:span.job-title [:a {:href (str "/jobs/"
                                          short-id
                                          "/"
                                          (jobs/job-slug job))} job-title]]
         [:span.company-name
          {:style "font-weight:bold;"}
          company-name]
         (when job-location
           [:span.job-location
            {:style "color:#888;font-weight:normal"}
            [:i.fa.fa-map-marker
             {:style "margin-right:5px"}]
            job-location])
         (when comp-cash
           [:span.comp-cash (jobs/currency-range comp-cash)])
         (when comp-equity
           [:span.comp-equity (jobs/equity-range comp-equity)])
         (when remote-ok?
           [:span.remote-ok
            {:style "color:#888"}
            [:i.fa.fa-globe
             {:style "margin-right:5px"}]
            "Remote"])]
        (remove nil?)
        (interpose [:span " ∙ "]))])

(defn $jobs-preview [jobs]
  [:div.jobs-preview
   [:div.row
    [:div.col-md-12
     [:h5 "Featured Jobs"]]]
   [:div.row
    [:div.col-md-12
     (->> jobs
          (map $job-preview))]]
   [:div.row
    [:div.col-md-12.text-right
     [:a {:style "font-size:12px"
          :href "/jobs"} "More Clojure Jobs"]]]])

(defn $index [top-contribs recently-updateds]
  [:div
   [:div.row
    [:div.col-md-12
     [:section
      [:h1 "ClojureDocs is a community-powered documentation and examples repository for the " [:a {:href "http://clojure.org"} "Clojure programming language"] "."]]
     [:section
      [:div.search-widget
       [:form.search {:method :get :action "/search" :autocomplete "off"}
        [:input.form-control.placeholder
         {:type "text"
          :name "query"
          :placeholder "Looking for?"
          :autoFocus "autofocus"
          :autoComplete "off"}]
        [:ul.ac-results]]]]]]
   [:div.row
    [:div.col-md-12
     [:section
      [:h5 "Top Contributors"]
      [:div.top-contribs
       (if-not (empty? top-contribs)
         (map util/$avatar top-contribs)
         [:div.null-state "Uh-oh, no contributors!"])
       [:div.migrate-account
        [:a {:href "/migrate-account"} "Migrate your old ClojureDocs account"]]]]
     [:section
      ($jobs-preview (take 3 jobs/DATA))]
     [:section
      [:h5 "Recently Updated"]
      [:div.row
       (->> recently-updateds
            (map $render-recently-updated)
            (partition-all 3)
            (map (fn [rs]
                   [:div.col-sm-6 rs])))]]]]
   [:section
    [:div.row
     [:div.col-md-12
      [:h5 "On Clojure"]]
     [:div.col-md-6
      [:p "Clojure is a concise, powerful, and performant general-purpose programming language that runs on the JVM, CLR, Node.js, and modern mobile and desktop web browsers."]
      [:p
       "New to Clojure and not sure where to start? Here are a few good resources to get you off on the right foot:"]
      [:ul.getting-started-resources
       [:li [:a {:href "https://changelog.com/posts/rich-hickeys-greatest-hits/"} "Rich Hickey's Greatest Hits (videos)"]]
       [:li [:a {:href "http://www.braveclojure.com"} "Clojure for the Brave and True"]]
       [:li [:a {:href "http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome"}
             "Clojure from the Ground Up"]]
       [:li [:a {:href "http://4clojure.org"} "4Clojure (learn Clojure interactively)"]]
       [:li [:a {:href "http://clojurescriptkoans.com/"} "ClojureScript Koans"]]
       [:li [:a {:href "https://repl.it/languages/clojure"} "Run Clojure code live in your browser"]]]
      [:p "There's no denying that Clojure is just so "
       " *different* "
       " from what most of us are used to (what is up with all those parentheses?!), "
       "so it's no surprise that it"
       " takes a bit to get your head around it. Stick with it, and you won't be disappointed."]
      [:p "But don't take our word for it, here's what XKCD has to say:"]
      [:p [:img.xkcd {:src "/img/lisp_cycles.png"}]]
      [:p "Seems like more than a few these days. Happy coding!"]]
     [:div.col-md-6
      [:div.example-code
       (-> "src/examples/clj/first.clj"
           slurp
           (syntax/syntaxify :stringify-style? true))]]]]
{'fraction_non_alphanumeric': 0.1618605347914014, 'fraction_numerical': 0.006591266571792375, 'mean_word_length': 1.9565987599645704, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 34, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5507826', 'n_tokens_mistral': 4735, 'n_tokens_neox': 4362, 'n_words': 1053}