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 statefunction.web | |
(:require [compojure.core :refer [defroutes GET PUT POST DELETE ANY]] | |
[compojure.handler :refer [site]] | |
[compojure.route :as route] | |
[clojure.java.io :as io] | |
[ring.middleware.stacktrace :as trace] | |
[ring.middleware.session :as session] | |
[ring.middleware.session.cookie :as cookie] | |
[ring.adapter.jetty :as jetty] | |
[ring.middleware.basic-authentication :as basic] |
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 flat-workflow.functions.sample-functions) | |
(defn ^{:batch-size 10 :onyx? true} increment-age [segment] | |
(update-in segment [:age] inc)) | |
(defn ^{:batch-size 10 :onyx? true} legal? | |
"hello world" | |
[age segment] | |
age) |
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
Executing before task -=___ Peer 1 starts task/job and batch | |
Executing before batch -=__/ Segments are loaded through the :core.async/read-from-chan :in | |
Executing after batch -=__/ | |
Executing before batch -=___ Segments are loaded into the :inc function and processed | |
Executing after batch -=__/ | |
Executing before batch -=___ Segments are loaded through the :core.async/write-to-chan :out | |
Executing after task -=___ Why does this happen *before* "Executing after batch" | |
Executing after batch -=__/ |
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 try-parse [x] | |
(try | |
(json/parse-string x true) | |
(catch Exception e | |
x))) | |
(defn lazy-test-data [] | |
"Returns a channel that reads json maps line by line from mock_data.json " | |
(let [channel (chan 5 (map try-parse))] | |
(future (with-open [rdr (clojure.java.io/reader "resources/mock_data.json")] |
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
;; Code | |
[[:in :concat-names] | |
[:concat-names :parse-dates] | |
[:parse-dates :time-left] | |
[:time-left :notify-near-expiration] | |
[:notify-near-expiration :out] | |
[:time-left :out]] | |
;; What the code means | |
:in ; Read data line-by-line from a file |
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 gen-contact-table | |
[size] | |
(mapv (fn [i] | |
{:name (str (rand-nth ["Gardner" "Mike" "Matt" "Jordan" "Vinny" "Jacob"]) | |
" " | |
(rand-nth ["Vickers" "Heskie" "Dawson" "Carol" "Stark"])) | |
:email (rand-nth ["[email protected]" "[email protected]" "[email protected]"]) | |
:position (rand-nth ["floor-sweeper" "cart-pusher" "president"]) | |
:company (rand-nth ["mcdonalds" "carousel" "medlyfe" "YoloCorp"]) | |
:expertise [(rand-nth ["avaya" "nortel" "cisco" "alarmtraq"]) |
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
export GOVC_RESOURCE_POOL='*/Resources' |
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
function setjdk() { | |
if [ $# -ne 0 ]; then | |
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin' | |
if [ -n "${JAVA_HOME+x}" ]; then | |
removeFromPath $JAVA_HOME | |
fi | |
export JAVA_HOME=`/usr/libexec/java_home -v $@` | |
export PATH=$JAVA_HOME/bin:$PATH | |
fi | |
} |
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
mv lib lib2 // Moved the symlink | |
cp lib2 ~/jars // copied the jars from lib2 to ~/jars | |
cp -r lib2 ~/jars // recursive copy ^^ | |
cp -r lib2 ~/jars // recursive copy ^^ | |
sudo cp -r lib2 ~/jars // recursive copy ^^ sudo | |
find lib2 -user root -exec cp {} ~/lib/{} \; // copy jars owned by root to ~/lib in my local | |
find lib2/ -user root -exec cp {} ~/lib/{} \; // sudo copy jars owned by root to ~/lib in my local | |
ls lib2 | |
mv lib2 lib // reset lib2 to lib |
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
[:pdf-table | |
[10 20 15] | |
["foo" [:chunk {:style :bold} "bar"] [:phrase "baz"]] | |
[[:pdf-cell "foo"] [:pdf-cell "foo"] [:pdf-cell "foo"]] | |
[[:pdf-cell "foo"] [:pdf-cell "foo"] [:pdf-cell "foo"]]] |
OlderNewer