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
#!/bin/bash | |
export DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/R.framework/Resources/lib:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/server | |
R |
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
(defun clojure-file-p (file-name) | |
"Determines if a file-name belongs to a clojure file." | |
(string-match "clj[csx]?$" file-name)) | |
(ert-deftest hola () | |
(should (not (clojure-file-p "hola.cl"))) | |
(should (not (clojure-file-p ""))) | |
(should (not (clojure-file-p "c"))) | |
(should (clojure-file-p "hola.clj")) | |
(should (clojure-file-p "hola.cljs")) |
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
(defun guess-clojure-test-file () | |
"Guesses the test file path of the current buffer if it is a clojure file." | |
(interactive) | |
(let ((clojure-file-name buffer-file-name)) | |
(with-temp-buffer | |
(insert clojure-file-name) | |
(goto-char (point-max)) | |
(search-backward "src") | |
(replace-match "test") | |
(goto-char (point-max)) |
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
#!/bin/bash | |
# first colon turns getopts into silent mode | |
# that also sets OPTARG when errors happen | |
# | |
# options with arguments have a colon AFTER the | |
# option letter | |
# in the example, a requires an option, b no | |
while getopts ":a:b" opt; do |
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 cucutest.features | |
(:require [clojure.test :refer :all]) | |
(:import [cucumber.api.cli Main])) | |
(deftest ^:cucumber run-cucumber | |
(let [cucumber-args ["--plugin" "progress" "--glue" "test/features/step_definitions" "test/features"]] | |
(Main/main (into-array cucumber-args)))) |
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 clj-wb.ds | |
(:require [datascript.core :as d])) | |
(let [schema {:tags {:db/cardinality :db.cardinality/many}} | |
conn (d/create-conn schema)] | |
(d/transact! conn [{:db/id 1 | |
:name "John Doe" | |
:status :ok | |
:tags ["cplusplus" "java"]} | |
{:db/id 2 |
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 process-request | |
"The heart of the Application Gateway. Checks if word is not _forbidden_ or | |
_cached_ and if is not the case, it forwards the request to the orignal | |
server." | |
[word] | |
(debug "Received request for word" word) | |
(cond | |
(forbidden? word) (forbidden-response word) | |
(cached? word) (cached-response word) | |
:else (forward-request-and-cache! word (env :forward-port)))) |
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
;; The Application Gateway | |
(defroutes appgw | |
(GET "/uppercase/:text" [text] | |
(process-request text)) | |
(route/not-found | |
(-> (r/response "NOT FOUND")))) |
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
(defroutes webapp | |
(GET "/uppercase/:text" [text] | |
(do | |
(debug "Received request for" text) | |
(-> (r/response (json/write-str {:status :ok :text (s/upper-case text)})) | |
(r/content-type "application/json")))) | |
(route/not-found | |
(do | |
(debug "Unknown route") | |
(-> (r/response (json/write-str {:status :err :reason :op-not-found})) |
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 hdp-clj-wb.core | |
"Some tests with hadoop mapfiles. Example usage. | |
* Create a file with 1000 keys (from 000 to 999) | |
(hdp-clj-wb.core/make-map-file \"hdfs://localhost:9000/user/me/map3\" 1000) | |
* Get the MD5 of the key 235 of 1000 | |
(hdp-clj-wb.core/get-md5 \"hdfs://localhost:9000/user/me/map3\" 234 1000) | |
* Get 4 items from the key 990 of 1000 | |
(hdp-clj-wb.core/get-some-md5 \"hdfs://localhost:9000/user/me/map3\" 990 1000 4) | |
" | |
(:require [hdfs.core :as hdfs]) |
NewerOlder