Skip to content

Instantly share code, notes, and snippets.

dminuoso

Block or report user

Report or block dminuoso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tbqueue.rb
class TBQueue
def initialize size
tvar = Concurrent::TVar
@read = tvar.new []
@write = tvar.new []
@rsize = tvar.new 0
@wsize = tvar.new size
end
View gist:ffadea142d47d8ffa6bf092aed4907cf
λ foobar master ✗ docker build .
Sending build context to Docker daemon 60.93kB
Step 1/8 : FROM haskell:8.4
---> b3e06e1d3bb7
Step 2/8 : USER root
---> Using cache
---> b21f896888c0
Step 3/8 : ADD . /app
---> 1a026c288c89
Step 4/8 : WORKDIR /app
@dminuoso
dminuoso / Sentinel.hs
Created Jul 20, 2018 — forked from borsboom/Sentinel.hs
hedis wrapper for Redis Sentinel support
View Sentinel.hs
{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, MultiParamTypeClasses, NamedFieldPuns,
NoImplicitPrelude, OverloadedStrings, RankNTypes, ScopedTypeVariables, TupleSections,
ConstraintKinds, TemplateHaskell, StandaloneDeriving #-}
{-# OPTIONS_GHC -funbox-strict-fields -Wall -Werror #-}
-- dependencies: hedis retry safe data-default uuid monad-logger basic-prelude lifted-base either
-- | Wrapper for hedis to support redis-sentinel. It is
-- built-atop of, and re-exports most of, the "Database.Redis" module.
--
View gist:f3e0f276935e0eef31fcee67d5a0a637
| IdleTimeout Word32
| TerminationAction TerminationAction
| CalledStationId ByteString
| CallingStationId ByteString
| IdleTimeout Word32
| TerminationAction TerminationAction
| CalledStationId ByteString
| CallingStationId ByteString
View f.hs
catchesHandler :: [Handler a] -> SomeException -> IO a
catchesHandler handlers e = foldr tryHandler (throw e) handlers
where tryHandler (Handler handler) res
= case fromException e of
Just e' -> handler e'
Nothing -> res
View A.hs
module A where
class T a where
t :: a -> Bool
View const.rb
Const = Struct.new(:value) do
def fmap(*args)
-> (func) { self }.curry[*args]
end
def self.make(*args)
-> (o) { new(o) }.curry[*args]
end
end
View graham.hs
module Graham where
import Data.List (sortBy)
import Data.Ord (comparing)
import Data.Monoid
data Direction = Left'
| Right'
| Straight'
deriving (Show)
View contt.hs
module ContT where
import Control.Monad.Trans.Class
newtype ContT r m a = ContT { runContT :: (a -> m r) -> m r }
instance Functor (ContT r m) where
fmap f (ContT cv) = ContT $ \c ->
cv (c . f)
View state.hs
combine1 :: (a -> a) -> State [a] ()
combine1 op = do
a <- pop
push $ op a
combine2 :: (a -> a -> a) -> State [a] ()
combine2 op = do
a <- pop
b <- pop
push op a b
You can’t perform that action at this time.