Make sure there is at least one file in it (even just the README.md)
ssh-keygen -t rsa -C "your_email@example.com"
(conj collection item) adds item to collection. To do that, it needs to realize collection. (I'll explain why below.) So the recursive call happens immediately, rather than being deferred.
(cons item collection) creates a sequence which begins with item, followed by everything in collection. Significantly, it doesn't need to realize collection. So the recursive call will be deferred (because of using lazy-seq) until somebody tries to get the tail of the resulting sequence.
The following is how it works internally:
cons actually returns a clojure.lang.Cons object, which is what lazy sequences are made of. conj returns the same type of collection which you pass it (whether that is a list, vector, or whatever else). conj does this using a polymorphic Java method call on the collection itself. (See line 524 of clojure/src/jvm/clojure/lang/RT.java.)
What happens w
| const listeners = (function listAllEventListeners() { | |
| let elements = []; | |
| const allElements = document.querySelectorAll('*'); | |
| const types = []; | |
| for (let ev in window) { | |
| if (/^on/.test(ev)) types[types.length] = ev; | |
| } | |
| for (let i = 0; i < allElements.length; i++) { | |
| const currentElement = allElements[i]; |
If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:
$ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)$ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)$ git config --global alias.logs "log --show-signature" (now available as $ git logs)$ git config --global alias.cis "commit -S" (optional if global signing is false)$ echo "Some content" >> example.txt$ git add example.txt$ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)| Foreword | |
| ======== | |
| This is a very rough draft of the tutorial I'm going to put on | |
| compojure.org. It's not complete, but it covers most of the basics. | |
| There's a possibility some of the terminology (such as handlers and | |
| routes) might change, but I'll let you know if it does. The technical | |
| content, however, should be accurate and up to date. | |
| Criticism is very welcome; I'd like to know if anything is unclear or |
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.
| // Simulate a call to Dropbox or other service that can | |
| // return an image as an ArrayBuffer. | |
| var xhr = new XMLHttpRequest(); | |
| // Use JSFiddle logo as a sample image to avoid complicating | |
| // this example with cross-domain issues. | |
| xhr.open( "GET", "http://fiddle.jshell.net/img/logo.png", true ); | |
| // Ask for the result as an ArrayBuffer. | |
| xhr.responseType = "arraybuffer"; |
| ;; example rails like console for compojure showing params, etc. for each request | |
| (ns bus.core | |
| (:use compojure.core | |
| ring.adapter.jetty | |
| ... | |
| ... | |
| (:use ring.middleware.params)) | |