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 deteam.core-async-sandbox | |
(:require [clojure.core.async :as async] | |
[clojure.tools.logging :as log])) | |
(def tmp-chan (async/chan 5)) | |
(def waiting-time-ms 500) | |
(defn -main [] | |
(log/info "Started the program") |
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
# Codeship + Haskell (cabal) | |
cabal update | |
cabal install cabal-install | |
export PATH=$HOME/.cabal/bin:$PATH | |
cabal sandbox init | |
cabal install --only-dependencies --enable-tests | |
cabal configure --enable-tests | |
cabal build |
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
module Main where | |
import Control.Monad.State (StateT(..), runStateT, modify, get) | |
import Control.Monad.Reader (ReaderT(..), runReaderT, ask) | |
import Control.Monad.Trans.Class (lift) | |
import Control.Monad.IO.Class (liftIO) | |
type MySuperMonad = ReaderT String (StateT Int IO) |
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
<!doctype html> | |
<html> | |
<head> | |
<!-- ALL OTHER FILES --> | |
<style> | |
.green { | |
color: green; | |
} | |
</style> | |
<script src="jquery-1.11.1.js"></script> |
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
module Main where | |
import Control.Monad.State.Lazy | |
step start stop (currentValue, modifier) = (currentValue, newState) | |
where reverseModifier = (currentValue + modifier > stop) || (currentValue + modifier < start) | |
modifier' = if reverseModifier | |
then | |
-modifier | |
else |
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
var housePrice = 15000; | |
var buyCoke = setupPrice('coke', 50); | |
var buyHotDog = setupPrice('hot-dog', 150); | |
var buyHouse = setupPrice('house', housePrice); | |
var salary = 500; | |
var getPaid = modifyState(sum.bind(null, salary)); | |
var saveForHouse = replicate( Math.floor(housePrice / salary), getPaid); |
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
// The Type | |
function Maybe(){}; | |
// `Nothing` Type Constructor | |
function Nothing() { | |
this.value = null; | |
}; | |
// `Just` Type Constructor | |
function Just(value) { |
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
module Main where | |
import Control.Monad.State.Lazy | |
import Control.Applicative ((<$>), (<*>)) | |
myInc = state (\n -> (n, n * n)) | |
myState = (,) <$> myInc <*> myInc | |
main = print $ computeState |
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
data ApiSettings = ApiSettings { | |
settingsAuth :: Maybe BasicAuth | |
} |
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
// It JavaScript it's okay to do like that: | |
friend.gift = function(){ | |
var deferred = $.Deferred(); | |
somewhenInFuture(function(gift){ | |
deferred.resolve(gift); | |
}) | |
return deferred.promise(); | |
} |
NewerOlder