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
# 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 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 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 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 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(); | |
} |
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
import Control.Concurrent | |
import Control.Concurrent.Async | |
import System.Random | |
delayedOutput :: String -> IO () | |
delayedOutput m = do | |
gen <- newStdGen | |
let (t, _) = randomR (1, 10) ge | |
-- delay in microseconds | |
threadDelay (t * 1000000) |
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
import Control.Concurrent | |
import Control.Concurrent.Chan | |
import System.Random | |
delayedOutput :: String -> Chan String -> IO () | |
delayedOutput m c = do | |
gen <- newStdGen | |
let (t, _) = randomR (1, 10) gen | |
-- delay in microseconds |
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
module ConceptCode ( | |
up, | |
down | |
) where | |
import Control.Monad | |
import Data.List | |
{- |
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
import Control.Monad | |
import Data.List | |
-- !! TODO: обернуть всю эту красоту в модуль, мб отдельные типы данных добавить | |
{- | |
Супер классная штука для формирования списка списков %) | |
Да, ее надо запомнить |
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
tmp = Tempfile.new("out") | |
tmp << "things" | |
tmp.close | |
puts File.read(tmp.path) |
NewerOlder