Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
module InstantNeighbour.VanMan.Servant
( makeHandler
) where
import Protolude
// Transforms an object containing arbitrary keys, and promise values, into a
// promise-wrapped object, with the same keys and the result of resolving each
// promise as values.
const promiseAllObject = (obj) => {
const keys = Object.keys(obj);
const values = keys.map((k) => obj[k]);
return Promise.all(values).then((promises) =>
promises.reduce((all, promise, idx) => ({ ...all, [keys[idx]]: promise }), {})
);
}
/*
PluginDetect Javascript Library http://www.pinlady.net/PluginDetect/
Copyright (C) 2008-2016, Eric Gerds
Released under MIT license http://www.pinlady.net/PluginDetect/license/
Browser Plugin Detection for QuickTime/Java/DevalVR/Flash/Shockwave/WindowsMediaPlayer/
@DanMeakin
DanMeakin / TrustPilotChallenge.hs
Created August 1, 2017 16:12
My Haskell solution to the TrustPilot code challenge.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
module TrustPilotChallenge where
import Control.Monad
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy.Char8 as BL
import Data.Digest.Pure.MD5
import Data.Function (on)