This file contains hidden or 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
| ;; Original example (in Javascript) at: http://code.shutterstock.com/rickshaw/examples/lines.html | |
| (def graph-with-legend | |
| (let [series-data (array (array) (array) (array)) | |
| random (Rickshaw.Fixtures.RandomData. 150)] | |
| (dotimes [i 150] | |
| (.addData random series-data)) | |
| (doto | |
| (Rickshaw.Graph. (clj->js {:element (.getElementById js/document "chart") | |
| :renderer "line" | |
| :width 960 |
This file contains hidden or 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
| try { | |
| var RIGHTCURLYBRACE = "}", LEFTCURLYBRACE = "{"; | |
| // bookmarklet to kick things off | |
| //javascript:function%20runCode(e)%20%7Be.preventDefault();eval(document.getElementById(%22codearea%22).value);return%20false;%7D;(function()%7Ba=document.createElement(%22div%22);b=document.body.appendChild(a);b.style.background=%22%23eeeeee%22;b.style.width=%22100%25%22;b.style.height=%22100px%22;b.innerHTML='%3Ctextarea%20id=%22codearea%22%3E%3C/textarea%3E%3Cbutton%20id=%22runcodebutton%22%3ERun%3C/button%3E';document.getElementById('runcodebutton').addEventListener(%22click%22,runCode);a.style.position=%22absolute%22;a.style.top=%220px%22;document.getElementById(%22codearea%22).value=window.localStorage.getItem(%22codeMSG%22);a.style.zIndex=%221000%22%7D)(); | |
| function bootstrap() { | |
| var startTheDance = 5000; |
This file contains hidden or 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
| Hello World |
This file contains hidden or 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 addUploadControl() { | |
| if(document.getElementById("imageUpload")===null) { | |
| var fileInputContainer=document.createElement("div"); | |
| var fileInput=document.createElement("input"); | |
| fileInputContainer.style.backgroundColor="white"; | |
| fileInputContainer.style.padding="10px"; | |
| fileInputContainer.style.borderColor="black"; | |
| fileInputContainer.style.borderRadius="10px"; |
This file contains hidden or 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
| try { | |
| var RIGHTCURLYBRACE="}",LEFTCURLYBRACE="{"; | |
| // bookmarklet to kick things off | |
| //javascript:function%20runCode(e)%20%7Be.preventDefault();eval(document.getElementById(%22codearea%22).value);return%20false;%7D;(function()%7Ba=document.createElement(%22div%22);b=document.body.appendChild(a);b.style.background=%22%23eeeeee%22;b.style.width=%22100%25%22;b.style.height=%22100px%22;b.innerHTML='%3Ctextarea%20id=%22codearea%22%3E%3C/textarea%3E%3Cbutton%20id=%22runcodebutton%22%3ERun%3C/button%3E';document.getElementById('runcodebutton').addEventListener(%22click%22,runCode);a.style.position=%22absolute%22;a.style.top=%220px%22;document.getElementById(%22codearea%22).value=window.localStorage.getItem(%22codeMSG%22);a.style.zIndex=%221000%22%7D)(); | |
| function bootstrap() { | |
| // get ourself |
This file contains hidden or 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 tron.bots | |
| (:require [tron.core :as tron])) | |
| (defn empty-look | |
| "A mock look function which just checks for the arena | |
| boundaries." | |
| [pos] | |
| (when-not (tron/valid-pos? pos) :wall)) | |
| (defn mock-look |
This file contains hidden or 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
| import java.io.IOException; | |
| import java.nio.file.FileVisitResult; | |
| import java.nio.file.Files; | |
| import java.nio.file.Path; | |
| import java.nio.file.Paths; | |
| import java.nio.file.SimpleFileVisitor; | |
| import java.nio.file.attribute.BasicFileAttributes; | |
| import org.apache.commons.lang3.StringUtils; |
This file contains hidden or 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 sieve (atom [])) | |
| (def siever (agent sieve)) | |
| (send-off siever | |
| (fn [x test-set] | |
| (doall | |
| (map (fn [n] | |
| (if (not (some | |
| #(zero? (mod n %)) |
This file contains hidden or 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
| ; A little function that adds its two parameters together | |
| (defn addit [x y] (+ x y)) | |
| ; This adds the value supplied in the second parameter to the atom in the first parameter, then returns the atom | |
| (defn atom-adder [x y] (swap! x (partial addit y)) x) | |
| (def value-atom (atom 1)) | |
| ; Create an agent with a reference to the atom | |
| (def counter-agent (agent value-atom)) |
This file contains hidden or 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=> (map #(partition 3 %) ["123---" "456---"]) | |
| (((\1 \2 \3) (\- \- \-)) ((\4 \5 \6) (\- \- \-))) | |
| user=> (map #(map (partial apply str) (partition 3 %)) ["123---" "456---"]) | |
| (("123" "---") ("456" "---")) | |
| user=> (map #(map (partial apply str) (partition 3 %)) s) ["123---" "456---"]) | |
| CompilerException java.lang.RuntimeException: Unable to resolve symbol: s in this context, compiling:(NO_SOURCE_PATH:1:1) | |
| ["123---" "456---"] | |
| RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:219) |