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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Linq; | |
using System.Security.Cryptography; | |
using System.Text; | |
using System.Net.Mail; | |
using System.Web; | |
using System.Xml.Serialization; |
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
fix-row = (a) -> | |
date = new Date (new Date a["Row Labels"] .valueOf! + (4 * 1000 * 3600)) | |
{ | |
date | |
visits: parse-float a["Visits Count"] | |
visitsCost: parse-float a["Visits Cost"] | |
totalCost: parse-float a["Total Cost"] | |
subscribers: parse-float a["Subscribers Count"] | |
subscribersCost: parse-float a["Subscribers Cost"] | |
eCPS: parse-float a["eCPS"] |
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
is-digit = (c) -> 48 <= (c.char-code-at 0) <= 57 | |
is-space = (c) -> code = c.char-code-at 0 ; [9, 10, 32] |> any (== code) | |
is-lower-letter = (c) -> | |
return false if !c | |
code = c.char-code-at 0 ; code >= 97 and code <= 122 | |
is-upper-letter = (c) -> code = c.char-code-at 0 ; code >= 65 and code <= 90 | |
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
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
import Control.Monad.Trans | |
import Control.Monad.Trans.State | |
import Control.Monad.Trans.Reader | |
import Control.Monad.Identity | |
import qualified Control.Monad.State as S | |
import qualified Control.Monad.Reader as R | |
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 System.Random | |
import Control.Monad.Trans | |
import Control.Monad.Trans.State | |
import Control.Monad.Identity | |
import qualified Control.Monad.State as S | |
type Eval a g = StateT (g Identity) a | |
runEval :: (RandomGen g) => g -> StateT g Identity a -> (a, g) |
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 System.Directory (getDirectoryContents, doesDirectoryExist) | |
data Tree a = Directory a [Tree a] | File a deriving (Show) | |
makeTheTree :: FilePath -> IO (Tree FilePath) | |
makeTheTree path = do | |
isDirecotry <- doesDirectoryExist path | |
if not isDirecotry then | |
return $ File path | |
else do |
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
{-# LANGUAGE FlexibleInstances #-} | |
class Arg a where | |
collect' :: [String] -> a | |
-- extract to IO | |
instance Arg (IO ()) where | |
collect' = mapM_ putStrLn | |
-- extract to [String] |
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 Control.Monad | |
import Data.List (intercalate) | |
facs :: [Integer] | |
facs = 1 : 1 : 2 : 6 : zipWith (*) [4 ..] (drop 2 . tail $ facs) | |
fibs :: [Integer] | |
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | |
main = do |
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 SetInterval | |
import SetIntervalT | |
import Control.Concurrent | |
import Control.Exception | |
import Control.Monad.State | |
sprint :: (Show b) => MVar () -> b -> IO () | |
sprint mvar b = do | |
putMVar mvar () | |
print b |
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" = ("insertText:", "α"); | |
"~b" = ("insertText:", "β"); | |
"~g" = ("insertText:", "γ"); | |
"~i" = ("insertText:", "ι"); | |
"~k" = ("insertText:", "κ"); | |
"~@k" = ("insertText:", "κ"); | |
"~^d" = ("insertText:", "∂"); | |
"~d" = ("insertText:", "δ"); | |
"~$D" = ("insertText:", "Δ"); |