Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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
scp -v -r resources/public/* dirnet:/var/www/static/ | |
lein ring uberjar | |
rsync --verbose --progress -t target/*.jar dirnet:/var/www | |
ssh host "sudo service my-app restart" |
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> (defn page-search | |
[search-term & {:keys [page page-size] :or {page 0 page-size 100}}] | |
(case page | |
0 {:items ["page zero"]} | |
1 {:items ["page one"]} | |
2 {:items ["page two"]} | |
nil)) | |
#'user/page-search | |
user> (defn lazy-page-search | |
[search-term & {:keys [page page-size] :or {page 0 page-size 100}}] |
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
When there is a profiles.clj file in the project directory, | |
and it has entries like: {:profiles {:dev {:special-password "secret"}}} | |
M-x set-variable cider-lein-parameters "with-profile +my-special-snowflake repl :headless" |
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 Heroku/Clojure/GrapheneDB Setup | |
# To enable custom build task. default is `lein uberjar` this changes it to `lein ring uberjar` | |
heroku config:add LEIN_BUILD_TASK="ring uberjar" | |
# To run a ring server uberjar, in the Procfile | |
web: java $JVM_OPTS -jar target/my-app.jar | |
# Because the GRAPHENEDB_URL does not end with `/db/data` | |
(def db-url |
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
sudo apt-get update | |
sudo apt-get install nginx | |
sudo update-rc.d nginx defaults | |
wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add - | |
echo 'deb https://debian.neo4j.org/repo stable/' | sudo tee /etc/apt/sources.list.d/neo4j.list | |
sudo apt-get update | |
sudo apt-get install neo4j |
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
description "Run clojure app" | |
start on runlevel startup | |
stop on runlevel shutdown | |
respawn | |
env PORT=5000 | |
exec java -cp /var/www/app.jar clojure.main -m app.handler |
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
git archive --format=tar origin/master | gzip -9c | ssh [email protected] "cd /var/www; tar xvzf -" |
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
http://stackoverflow.com/questions/37654293/replace-text-in-all-files-within-a-directory-subdirectories-in-emacs/37685982#37685982 | |
I generally do this the way @lawlist suggests. Here it is step-by-step: | |
Install wgrep from Melpa or some other way. I recommend also wgrep-ag and ag if you use The Silver Searcher. | |
Use M-x rgrep (or M-x ag) to search the files and get a list of lines to potentially change. | |
In the *grep* buffer, run M-x wgrep-change-to-wgrep-mode. I bind this to C-x C-q in grep-mode-map. | |
Use query-replace-regexp (C-M-%), or do any other editing in the *grep* buffer. | |
Save the *grep* buffer with C-x C-s. Use C-c C-k to abort. The changes exist only in the *grep* buffer until you save it. You can re-enable wgrep mode any number of times. |
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
head -1 returns.csv | sed 's/[^,]//g' | wc -c |