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
port module Api exposing (..) | |
import JsonStuff exposing (ToJson, FromJson, getEncoder, getDecoder) | |
import Http | |
helpPostJson : String -> ToJson a msg -> FromJson b msg -> a -> Http.Request b | |
helpPostJson url toJson fromJson o = | |
Http.request | |
{ method = "POST" | |
, headers = [] |
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
-- Try to setup auto logout. But JWT parsing can fail in several ways. | |
-- | |
-- Failure strategy: | |
-- 1. Console log failure. | |
-- 2. The fallback (not shown below) is to instruct the user to | |
-- manually log out and back in when we receive 401 Unauthorized. | |
-- | |
-- TODO send failure to logging infrastructure. | |
notifyOnExpired : String -> Cmd Msg |
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 FileUtils exposing (..) | |
import Native.FileUtils | |
import Html exposing (..) | |
import Html.Events exposing (..) | |
import Http exposing (Body) | |
import Json.Decode as Json | |
type alias File = |
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 Combinators | |
// These are basic combinators that work with ASP.NET HttpContext. | |
// Feel free to add your own. | |
// | |
// most of this adapted from Giraffe v0.1.0-alpha025 | |
// https://github.com/dustinmoris/Giraffe/blob/v0.1.0-alpha025/src/Giraffe/HttpHandlers.fs | |
// Some combinators adapted from Suave | |
// https://github.com/SuaveIO/suave | |
// Both projects are Apache 2.0 Licensed |
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 ListFolds exposing (..) | |
{-| Alternative implementations of List.foldl and List.foldr | |
-- this will add the `fold` and `foldBack` functions to the List module | |
import ListFolds as List | |
List.fold (++) "" [ "Hello", " ", "World", "!" ] == "Hello World!" | |
-} |
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
// differences from Utf8Json GuidBits | |
// * parses Base64 encoded Guids | |
// * writes Guids without '-' character | |
[StructLayout(LayoutKind.Explicit, Pack = 1)] | |
public struct GuidBits | |
{ | |
[FieldOffset(0)] | |
public readonly Guid Value; |
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
namespace Utils | |
module Async = | |
let retn x = | |
async { return x } | |
let lift f = | |
f >> retn |
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 Ssm | |
module GetParametersWorkflow = | |
open Amazon.SimpleSystemsManagement.Model | |
open System.Net | |
type Failure = | |
| ParameterRequestFailed of exn | |
| ParameterRequestError of HttpStatusCode * Amazon.Runtime.ResponseMetadata |
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
Fri Mar 9 12:34:56 2018: Fri Mar 9 12:34:56 UTC 2018 | |
Fri Mar 9 12:34:56 2018: urandom start: failed. | |
Fri Mar 9 12:34:56 2018: ALSA: Restoring mixer settings... | |
Fri Mar 9 12:34:57 2018: INIT: Entering runlevel: 5 | |
Fri Mar 9 12:34:57 2018: Starting system message bus: dbus. | |
Fri Mar 9 12:34:57 2018: Starting bluetooth: bluetoothd. | |
Fri Mar 9 12:34:57 2018: Starting syslogd/klogd: done | |
Fri Mar 9 12:34:57 2018: bcm43xx_init | |
Fri Mar 9 12:34:57 2018: Flash firmware /lib/firmware/brcm/BCM43430A1.hcd | |
Fri Mar 9 12:35:02 2018: Set Controller UART speed to 921600 bit/s |
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
// F# type alias | |
type Builder = IApplicationBuilder -> IApplicationBuilder | |
let createWebServer settings = | |
let createBuilder () = (WebHostBuilder(), []) | |
let setConfig basePath (host: IWebHostBuilder, configs: Builder list) = | |
( host | |
.ConfigureAppConfiguration(fun (_: WebHostBuilderContext) (builder: IConfigurationBuilder) -> |
OlderNewer