This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns app.gpt | |
(:require [clj-http.client :as http] | |
[clojure.repl] | |
[cheshire.core :as json] | |
[clojure.pprint :refer [pprint]] | |
[taoensso.timbre :as log] | |
[clojure.core.async :as a :refer [<! >! go]] | |
[clojure.string :as str] | |
[clojure.java.io :as io]) | |
(:import [java.io InputStream])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clj-http.client :as http]) | |
(require '[clojure.core.async :as a]) | |
(require '[clojure.string :as string]) | |
(require '[clojure.java.io :as io]) | |
(import '[java.io InputStream]) | |
(def event-mask (re-pattern (str "(?s).+?\r\n\r\n"))) | |
(defn- parse-event [raw-event] | |
(->> (re-seq #"(.*): (.*)\n?" raw-event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clj-http.client :as http]) | |
(require '[clojure.core.async :as a]) | |
(require '[clojure.string :as string]) | |
(require '[clojure.java.io :as io]) | |
(import '[java.io InputStream]) | |
(def event-mask (re-pattern (str "(?s).+?\r\n\r\n"))) | |
(defn- parse-event [raw-event] | |
(->> (re-seq #"(.*): (.*)\n?" raw-event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; wrap-action should be called for all the defined cases, but not for the default case | |
(case v | |
1 (wrap-action (foo)) | |
2 (wrap-action (bar)) | |
3 (wrap-action (baz)) | |
(qux)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns queue-test | |
(:require [clojure.core.async :as async :refer [>! <! chan go go-loop put!]])) | |
(defn process! [item] | |
{:pre [item]} | |
(println "processing:" item)) | |
(defn init! [] | |
(let [q (chan)] | |
(go-loop [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (time (first (reduce concat (repeat 2000 [1])))) | |
"Elapsed time: 3.369 msecs" | |
1 | |
user=> (time (first (reduce into (repeat 2000 [1])))) | |
"Elapsed time: 9.901 msecs" | |
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns scanview.core | |
(:require [clojure.string :as string] | |
[clojure.data.csv :as csv] | |
[clojure.pprint :refer [pprint]] | |
[clojure.java.io :as io])) | |
(def regex #"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?") | |
(defn trim-line? [s] | |
(when-let [extra-alpha-chars (re-seq #"[A-DF-df-z]" s)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns example.core | |
(:require-macros [cljs.core.async.macros :refer [go go-loop]]) | |
(:require [om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true] | |
[clojure.string :as string])) | |
(def app-state (atom {:options {:a 1 :b 2 :c 3}})) | |
(defmulti changed-option (fn [k _] k)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn wrap-exception [f] | |
(fn [request] | |
(try (f request) | |
(catch Exception e | |
{:status 500 | |
:body "Exception caught"})))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[INFO] +- ring:ring:jar:1.2.0:compile | |
[INFO] | +- ring:ring-devel:jar:1.2.0:compile | |
[INFO] | | +- clj-stacktrace:clj-stacktrace:jar:0.2.5:compile | |
[INFO] | | \- ns-tracker:ns-tracker:jar:0.2.1:compile | |
[INFO] | | +- org.clojure:tools.namespace:jar:0.1.3:compile | |
[INFO] | | \- org.clojure:java.classpath:jar:0.2.0:compile | |
[INFO] | +- ring:ring-jetty-adapter:jar:1.2.0:compile | |
[INFO] | | \- org.eclipse.jetty:jetty-server:jar:7.6.8.v20121106:compile | |
[INFO] | | +- org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518:compile | |
[INFO] | | +- org.eclipse.jetty:jetty-continuation:jar:7.6.8.v20121106:compile |
NewerOlder