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
couponFields :: [FieldName] | |
couponFields = | |
[ FieldName "type" | |
, FieldName "code" | |
, FieldName "status" | |
, FieldName "createdBy.fullName" | |
, FieldName "createdBy.email" | |
, FieldName "createdBy.username" | |
] |
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
var assert = require('assert') | |
var inversions = require('Inversions').inversions | |
var list = require('Data.List') | |
describe('The inversion counting function', function() { | |
it('should find an inversion', function () { | |
assert.equal(inversions(list.Cons.create(1)(list.Cons.create(2)(list.Cons.create(3)(list.Cons.create(4)(list.Nil.value))))), 0) | |
assert.equal(inversions(list.Cons.create(2)(list.Cons.create(1)(list.Cons.create(3)(list.Cons.create(4)(list.Nil.value))))), 1) | |
}) | |
}) |
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
{ | |
logical_operator:"and", | |
conditions:[ | |
{ | |
path:"asset", | |
relation:"is", | |
values:[ | |
{ | |
type:"value", | |
id:4325 |
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
data ConditionValues a b c = I a | T b | S c | |
deriving (Eq, Ord, Read, Show) | |
instance (ToJSON a, ToJSON b, ToJSON c) => ToJSON (ConditionValues a b c) where | |
toJSON (I a) = toJSON a | |
toJSON (T b) = toJSON b | |
toJSON (S b) = toJSON b | |
instance (FromJSON a, FromJSON b, FromJSON c) => FromJSON (ConditionValues a b c) where | |
-- parseJSON f = I <$> parseJSON f |
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
data Filters = Filters | |
{ logicalOperator :: Text | |
, conditions :: [Condition | Filters] | |
} deriving (Show, Eq, Generic) | |
instance ToJSON Filters where | |
toJSON = genericToJSON $ aesonDrop 0 snakeCase | |
instance FromJSON Filters where | |
parseJSON = genericParseJSON $ aesonDrop 0 snakeCase |
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
{ | |
'conditions':[ | |
{ | |
'values':[ | |
'ip' | |
], | |
'path':'sg_status_list', | |
'relation':'is' | |
}, | |
{ |
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
- , enter | |
- , (:~>)(..) | |
- -- ** `Nat` utilities | |
- , liftNat | |
- , runReaderTNat | |
- , evalStateTLNat | |
- , evalStateTSNat | |
- , logWriterTLNat | |
- , logWriterTSNat | |
- -- ** Functions based on <https://hackage.haskell.org/package/mmorph mmorph> |
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
fromMaybeT :: Monad m => m a -> MaybeT m a -> m a | |
fromMaybeT x y = fmap fromJust . runMaybeT $ y <|> lift x | |
instance (AllCTUnrender list a, HasServer sublayout) | |
=> HasServer (Auth list a :> sublayout) where | |
type ServerT (Auth list a :> sublayout) m = | |
a -> ServerT sublayout m |
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
case mc of | |
Nothing -> return $ FailFatal $ serverErr' Forbidden | |
Just jwt -> do | |
mcs <- verifyClaims $ decodeUtf8 jwt | |
case mcs of | |
Nothing -> return $ FailFatal $ serverErr' Forbidden | |
Just clms -> do | |
let user = lookup "user" $ toList $ unregisteredClaims clms :: Maybe Value | |
case user of | |
Nothing -> return $ FailFatal $ serverErr' Forbidden |
NewerOlder