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 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 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 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 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 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 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 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 cljsaudio.core | |
(:require [goog.net.XhrIo] | |
[cljs.core.async :as async :refer [<! >! chan close!]]) | |
(:require-macros [cljs.core.async.macros :refer [go]])) | |
(defn decode-audio-data | |
[context data] | |
(let [ch (chan)] | |
(.decodeAudioData context | |
data |
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
(clojure.core.async/go | |
(let [sleepy-val (fn [v t] (clojure.core.async/go | |
(clojure.core.async/<! (clojure.core.async/timeout t)) | |
v)) | |
chans (clojure.core.async/merge (map #(sleepy-val % (rand-int 3000)) | |
(range 10)))] | |
(while (when-let [v (clojure.core.async/<! chans)] | |
(prn v) | |
v)))) |
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
(require '[clojure.core.async :as async refer [<! go timeout]) | |
(defn sleepy-val | |
[v t] | |
(go (<! (timeout t)) v)) | |
;; Will this produce [1 2 3 1.5 2.5 3.5] or [1 1.5 2 2.5 3 3.5]? | |
(go | |
(prn (<! (async/into [] | |
(async/merge [(.async/merge [(sleepy-val 1 1000) |
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
ls -1|sed -e "s/'/\\\'/g" -e "s/.flac//g"|xargs -I{} avconv -i {}.flac -c:a libmp3lame -b:a 256k {}.mp3 |