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
(let [translations {"issue_1" "Issue One" | |
"issue_2" "Issue Two" | |
"issue_3" "Issue Three" | |
"issue_4" "Issue Four"} | |
items [{:priority "high",:issues ["issue_1" "issue_2"]} | |
{:priority "low", :issues ["issue_3" "issue_4"]}]] | |
(map (fn [m] (apply merge m)) | |
(map (fn [{:keys [priority issues]}] | |
(map (fn [issue] | |
{(get translations issue), {:priority priority, |
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
(defprotocol Coercable | |
"Coerce Ruby objects to Clojure types" | |
(clj [this] "Coerce a Ruby object to its Clojure representation")) | |
(extend-protocol Coercable | |
org.jruby.RubyString | |
(clj [this] (str this))) | |
(extend-protocol Coercable | |
java.lang.Long |
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
(def mappings | |
{:sexp | |
{:properties | |
{:id {:type "integer" :store "yes"} | |
:input {:type "string" :store "yes" :analyzer "clojure_code"} | |
:output {:type "string" :store "yes" :analyzer "clojure_code"} | |
:value {:type "string" :store "yes" :analyzer "clojure_code"}}}}) | |
(defn create-getclojure-index [] | |
(when-not (esi/exists? "getclojure") |
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 remove-first [pred coll] | |
(let [[xs ys] (split-with (complement pred) coll)] | |
(concat xs (rest ys)))) | |
(remove-first (partial = 3) [1 2 3 1 2 3]) | |
;;; (1 2 1 2 3) | |
(remove-first even? [1 2 3 1 2 3]) | |
;;; (1 3 1 2 3) |
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
;; Make sure we can execute things in our ~/bin DIR | |
;; This may not be necessary if you're running emacs from the terminal. | |
(add-to-list 'exec-path (expand-file-name "~/bin")) | |
(setenv "PATH" (concat (expand-file-name "~/bin") ":" (getenv "PATH"))) | |
;; Packages | |
(require 'package) | |
(require 'hippie-exp) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/") t) |
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
getclojure.search> (pprint-code (esi/get-settings "getclojure")) | |
{:getclojure | |
{:settings | |
{:index.analysis.tokenizer.clojure_tokenizer.lowercase "true", | |
:index.analysis.tokenizer.clojure_tokenizer.pattern | |
"\\s+|\\(|\\)|\\{|\\}|\\[|\\]", | |
:index.analysis.analyzer.clojure_code.pattern | |
"\\s+|\\(|\\)|\\{|\\}|\\[|\\]", | |
:index.version.created "200499", | |
:index.number_of_shards "5", |
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
chat-server.server=> (dev/start) | |
nil | |
chat-server.server=> io.pedestal.service.http.sse - {:line 76, :msg "exception sending heartbeat", :throwable #<EofException org.eclipse.jetty.io.EofException>, :stacktrace "org.eclipse.jetty.io.EofException: null\n at org.eclipse.jetty.http.HttpGenerator.flushBuffer (HttpGenerator.java:914)\n org.eclipse.jetty.server.AbstractHttpConnection.flushResponse (AbstractHttpConnection.java:654)\n org.eclipse.jetty.server.Response.flushBuffer (Response.java:1056)\n io.pedestal.service.http.sse$flush_response.invoke (sse.clj:45)\n io.pedestal.service.http.sse$do_heartbeat$fn__3729.invoke (sse.clj:74)\n io.pedestal.service.http.sse$do_heartbeat.invoke (sse.clj:71)\n io.pedestal.service.http.sse$schedule_heartbeart$f__3744.invoke (sse.clj:82)\n clojure.lang.AFn.run (AFn.java:24)\n java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:439)\n java.util.concurrent.FutureTask$Sync.innerRunAndReset (FutureTask.java:317)\n java.util.concurrent.Fu |
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 anna.core | |
(:require [yokogiri.core :as y])) | |
(def client (y/make-client)) | |
(def base-uri "http://www.wordsmith.org") | |
(defn query-string [character-string] | |
(str base-uri | |
"/anagram/anagram.cgi?anagram=" |
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
(eval((fn[program](let [n (zipmap '(+ - > < . ?)(repeatedly gensym))](letfn[(f*[ | |
s] (if (vector? s) `(while (not (~(n '?))) ~@(map f* s)) `(~(n s))))]`(let [t# ( | |
int-array 100 0)pt# (atom 0)a#(fn[c#]#(aset t# @pt#(c# (aget t# @pt#))))b#(fn[d# | |
]#(swap! pt# d#)) ~(vec (map n '(+ - > <)))(map #(%1 %2)[a# a# b# b#](cycle [inc | |
dec]))~(n '.)#(print(char(aget t# @pt#)))~(n '?)#(zero?(aget t# @pt#))]~@(map f* | |
(read-string(str "("(->> program (interpose \space) (apply str)) ")" )))))))"+++ | |
+++++[>++++++++<-]>+.[>+<-]+++++[>-----<-]>--------.[>+<-]++++++++[>++++++++<-]> | |
++++++++++++.+++.+++++.[>+<-]+++++++++[>---------<-]>---.[>+<-]++++++++[>+++++++ | |
+<-]>+++++++++++++++.---------.[>+<-]++++++++[>--------<-]>------.[>+<-]++++++++ | |
[>++++++++<-]>++++++++.-------.++.++++++++.--.+++++.-------.[>+<-]++++++++[>---- |
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
javascript: (function () { | |
function c() { | |
var e = document.createElement("link"); | |
e.setAttribute("type", "text/css"); | |
e.setAttribute("rel", "stylesheet"); | |
e.setAttribute("href", f); | |
e.setAttribute("class", l); | |
document.body.appendChild(e) | |
} | |
function h() { |