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
(go | |
;; Get a worker from the buffered channel | |
(let [worker (<! servant-channel)] | |
;; execute the post message for the web worker | |
(post-message-fn worker (pr-str fn-key) args) | |
;; Add an event listener for the worker's return message | |
(.addEventListener worker "message" | |
#(go | |
;; Save the data | |
(>! out-channel (.-data %1)) |
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 test-cljs.core) | |
(def ^:export t (clj->js {:command "function"})) | |
(.log js/console t) | |
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
(def k (cljs.core.async/chan 3)) | |
;; This doesn't work as expected | |
(go | |
(.log js/console "loading: 42") | |
(>! k 42)) | |
;; This parks when trying to take from the channel | |
(go |
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
if (typeof(ArrayBuffer) === 'undefined') { | |
(function(globals){ | |
"use strict"; | |
globals.ArrayBuffer = function(){}; | |
globals.DataView = function(){}; | |
}(this)); | |
} |
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
Benchmarking CCM, with 1MB file (patched with arraybuffer) | |
Total Bytes 1048576 Chunk.js:156 | |
Benchmark took: 48028 ms Chunk.js:157 | |
Total Iterations: 100 iterations Chunk.js:158 | |
Average of : 480.28 ms per 1MB | |
Benchmarking CCM, with 1MB file (no patch) | |
Total Bytes 1048576 | |
Benchmark took: 7357 ms | |
Total Iterations: 10 iterations |
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
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: GnuPG v2.0.20 (GNU/Linux) | |
mQINBFHlbycBEADA5sfzue1g6wo7qUm+NmE8p3so6XGJE9lwtNJUimopdEezlffE | |
OJ6TZ3i72quwTwHNg2Xa4UMy+EUagf+dmawLGskbTPWtHXESny5wAMc98JyTIMvr | |
4CcBAKhBd2YmLTlF3DP5b00yc2Sf+AgKk8MRz6CCkCHcowHpj0/dFEsmxhqwJL6V | |
6V5BmMXR1jW2x1N0oVLbsOmVZ2SunrAUEv1XoT/50RopQffEiGdK2qaCGQI9llJK | |
J0I1+m3PtQPtaQCXPJaHJws6W5PTBXcMPEruiwemudjxmXNLS8zlxog7FyZexFbm | |
L5IHjQRztkDgvdqpH0jjA/hGcxPXtHIVR6+A+lc9kHlgrgGXJQ/ijn+alK3w5pYB | |
97t49JRaL5PAqRSKtRK/t9+cnP0KWGEgsEV5dmoGAYa25Qbqh6Ed2rj3/zyITT35 |
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
//My first Go program w/o any internet access | |
package main | |
import ( | |
"net/http" | |
"fmt" | |
) | |
type Game struct { |
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 -> converts (-> x (f a) (g b)) into (g (f x a) b) | |
the ->> converts (->> x (f a) (g b)) into (g b (f a x) ) |
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 get-current-price | |
"Gets the current price from a response" | |
[response] | |
(-> | |
(get response :body) | |
(parse-string) | |
(get-in ["return" "last" "display"]) | |
(println))) |
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
Philosopher: 2 is testing the waters! state: 1 1 1 | |
Philosopher: 0 is testing the waters! state: 1 1 1 | |
Philosopher: 3 is Eating! | |
Philosopher: 1 is Eating! | |
Philosopher: 4 is going to release the semaphore! | |
Philosopher: 2 is going to release the semaphore! | |
Philosopher: 0 is going to release the semaphore! | |
Philosopher: 3 is going to release the semaphore! | |
Philosopher: 1 is going to release the semaphore! |