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
RMFLAGS = -f | |
REAL = main.c | |
OBJ = $(REAL:.c=.o) | |
EXE = tpthreads | |
EFFACE = clean | |
RM = rm | |
COMP = gcc | |
EDL = gcc | |
LIBS = -pthread -O3 -ffast-math | |
API = |
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
class Ctrl | |
def close | |
user = User.new # load from somewhere | |
CloseAccountPolicy.new(user).apply! | |
puts user.inspect | |
end | |
end | |
# Nearly an AnemicDomainModel because some of it's behavor is externalized | |
class User |
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
<?php | |
// web/index.php in Silex | |
// .. | |
$app->register(new Silex\Provider\TranslationServiceProvider(), array( | |
'locale' => array('fr'), // Instead of 'locale' => 'fr', | |
)); |
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(list). | |
-export([merger/0, atomic_sort/0, accumulator/0, last/1, init/0, add/2, get/1]). | |
atomic_sort() -> | |
receive | |
{L, Accumulator, Merger, Last} -> | |
Accumulator ! {lists:sort(L), Merger, Last}, | |
atomic_sort() | |
end. |
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 Gol where | |
import Text | |
import Graphics.Input as Input | |
import Dict | |
import Set | |
import Benchmark (..) | |
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 Data.Function | |
import Data.List | |
import Data.Maybe | |
import Control.Monad | |
data XmlElement = | |
RegularNode String [XmlElement] | |
| EndNode String | |
| TextNode String | |
deriving (Show, Eq) |
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 Data.List(groupBy, sortBy) | |
import Data.Maybe(listToMaybe) | |
import Control.Applicative((<|>)) | |
data Trie k v = RootTrie [Trie k v] | |
| NodeTrie k [Trie k v] | |
| EndTrie v | |
| EmptyTrie | |
toTrie :: (Eq k, Ord k) => [([k], v)] -> Trie k v |
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 Kata | |
( kmeans | |
, randV | |
, prettifier | |
) where | |
import Data.List(groupBy, sortBy, minimumBy, unfoldr) | |
import Data.Function(on) | |
import System.Random(newStdGen, randomRs) |
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 Y2018.M11.D26.Exercise where | |
import qualified Data.Set as S | |
import Control.Monad(foldM) | |
import Data.List(sort) | |
{-- | |
An IQ puzzler: | |
Four (A, B, C and D) suspects were interrogated: |
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
private Mono<ModSeq> handleRetries(CassandraId mailboxId) { | |
return Mono.defer(() -> tryFindThenUpdateOnce(mailboxId)) | |
.retry(maxModSeqRetries); | |
} |
OlderNewer