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
#!/usr/bin/env stack | |
-- stack --resolver lts-9.8 script | |
module Main where | |
import Data.Functor (void) | |
import Data.Foldable (traverse_, for_) | |
import Data.Traversable (for) | |
import Control.Concurrent (forkIO, readChan, writeChan, newChan, getNumCapabilities) | |
import Control.Immortal (create, wait, Thread) |
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 (main) where | |
import qualified Control.Foldl as Fold | |
import Criterion.Main | |
import qualified Data.List | |
import Data.Maybe | |
import Data.Semigroup | |
naiveAvg, foldMapAvg, foldlAvg, foldAvg :: [Float] -> Float | |
naiveAvg xs = Prelude.sum xs / fromIntegral (Prelude.length xs) |
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
#!/usr/bin/env stack | |
-- stack --resolver nightly-2017-08-20 --install-ghc runghc --package compact | |
{-# LANGUAGE ExistentialQuantification #-} | |
module Main where | |
import Data.Compact | |
class SomeClass a where | |
someId :: a -> a |
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
{ | |
"adaptiveLowestDomain": "aengesha", | |
"adaptiveLevelsPassed": 0, | |
"domainDetails": [ | |
{ | |
"adaptiveStandardProgression": [ | |
{ | |
"changeDate": "2017-08-02T16:03:46.936525Z", | |
"standardId": "ohbeecei" | |
} |
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 #-} | |
module Main where | |
import Prelude hiding (readFile, writeFile) | |
import Control.Monad.Trans | |
import Control.Monad.State | |
import qualified System.IO as SIO | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import Data.Maybe |
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
" Enable eslint for given project buffer | |
" Store current cwd | |
let s:prev_cwd = getcwd() | |
" change path to project root for current buffer | |
let s:project_cwd = split(expand('%:p:h'), "js")[0] | |
lcd `=s:project_cwd` | |
" Assign proper eslint vars for this buffer | |
let s:eslint_path = system('PATH=$(npm bin):$PATH && which eslint') |
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 NoImplicitPrelude #-} | |
import Data.Foldable | |
import Control.Applicative | |
data Either a b = Left a | Right b | |
data Eithers t a b | |
= Eithers | |
{ lefts :: t a | |
, rights :: t 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
function accountAdd (foo, x) { | |
return foo.account + x | |
} | |
// accountAdd exhibits stamp coupling and data coupling. |
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
defmodule CSV do | |
defp linesTransform(str, acc) do | |
case String.split(str, ~r/\n|\r\n/) do | |
[] -> {:halt, acc} | |
[head] -> {[], acc <> head} | |
[head | tail] -> | |
interspersedLines = Enum.take(tail, Enum.count(tail) - 1) | |
{[acc <> head] ++ interspersedLines, List.last tail} | |
end |
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 BangPatterns #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module LossyHistogram | |
( Histogram | |
, histResolution | |
, histMagnitude | |
, histBuckets | |
, mkHistogram | |
, fromList | |
, keys |