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
static Maybe<string> TryGetErrorMessage(XElement html) | |
{ | |
return html.GetElementsByClassName("ErrorMessage").MaybeFirst(). | |
Where(x => !x.Attributes("style").Any() | |
|| !x.Attribute("style").Value.Contains("visibility:hidden")). | |
Or(html.GetElementsByClassName("ErrorText").MaybeFirst()). | |
Select(x => x.Value.Trim()); | |
} |
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
//add this as pre-request script on postman collection | |
const moment = require("moment") | |
const { | |
apiRoot, | |
authPath, | |
username, | |
password, | |
bearerTokenValidUntil | |
} = pm.variables.toObject(); |
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
module App | |
open Elmish | |
type State = | |
{ CurrentUser: string option } | |
type Msg = | |
| SignIn of string | |
| SignOut |
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
let inline websocket<'Data> = | |
FunctionComponent.Of(fun (props: {| url : string; retryTimeSpan : TimeSpan; onConnected: bool -> unit; onMessage: 'Data -> unit |}) -> | |
let mutable currentlyConnected = false | |
let mutable wasAlreadyConnected = false | |
let connected = Hooks.useState false | |
let mutable webservice = null | |
let connect() = | |
if currentlyConnected then () else | |
let ws = WebSocket.Create(props.url) |
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
Bulma.button [ | |
button.isPrimary | |
prop.children [ | |
Html.i [ prop.className "fas fa-user"; prop.style [ style.marginRight 5 ] ] | |
Html.text "Hello Feliz.Bulma" | |
] | |
] |
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
module Dapper.Extensions | |
open System | |
open System.Data.SqlClient | |
open Dapper | |
let extractValue (x:obj) = | |
match x with | |
| null -> null | |
| _ -> match x.GetType().GetProperty("Value") with |
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
module DapperFSharp = | |
open System.Data.SqlClient | |
open System.Dynamic | |
open System.Collections.Generic | |
open Dapper | |
let dapperQuery<'Result> (query:string) (connection:SqlConnection) = | |
connection.Query<'Result>(query) | |
let dapperParametrizedQuery<'Result> (query:string) (param:obj) (connection:SqlConnection) : 'Result seq = |
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
module Chiron.Extensions | |
let tryDeserializeWith (fromJson : Json<'a>) : Json -> Choice<'a, string> = | |
fun json -> | |
match fromJson json with | |
| JsonResult.Value x, _ -> Choice1Of2(x) | |
| JsonResult.Error err, _ -> Choice2Of2(err) | |
let tryDeserializeWithP (_, fromJson : Json<'a>) : Json -> Choice<'a, string> = | |
tryDeserializeWith fromJson |
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
module FSharp.Rop | |
let bind2 f x y = | |
match x, y with | |
| Ok xR, Ok yR -> f xR yR | |
| Error e, _ | _, Error e -> Error e | |
let apply resultF result = | |
match resultF with | |
| Ok f -> Result.map f result |
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
FROM ubuntu:latest | |
MAINTAINER Roman Provaznik <[email protected]> | |
ENV LANG C.UTF-8 | |
RUN apt-get update && apt-get -y -q install mono-complete fsharp | |
ADD . app/ | |
EXPOSE 8083 | |
ENTRYPOINT ["mono", "/app/SuaveIO.exe"] |