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 greengiraffe.App | |
| open System | |
| open System.IO | |
| open System.Collections.Generic | |
| open Microsoft.AspNetCore.Builder | |
| open Microsoft.AspNetCore.Hosting | |
| open Microsoft.AspNetCore.Http | |
| open Microsoft.Extensions.Logging | |
| open Microsoft.Extensions.DependencyInjection |
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
| const $ = (selector) => { | |
| return Array.prototype.slice.call(document.querySelectorAll(selector)); | |
| } |
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
| open Giraffe.HttpHandlers | |
| open Microsoft.AspNetCore.WebUtilities | |
| open System.IO | |
| open System | |
| let isMultipartContentType (contentType:string) = | |
| not(String.IsNullOrEmpty(contentType)) && | |
| contentType.IndexOf("multipart/", StringComparison.OrdinalIgnoreCase) >= 0 | |
| let getBoundary (contentType : string) = |
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 getXsd id = | |
| query { | |
| for messageItem in ctx.ProtoType.MessageType do | |
| for originalMessage in messageItem.``ProtoType.OriginalMessage by Id`` do | |
| for messageType in originalMessage.``ProtoType.MessageType by Id`` do | |
| where (messageItem.Id = id) | |
| select (messageType.Xsd) | |
| } |> Seq.head |
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
| declare module "react-throttle" { | |
| export interface DebounceProps extends React.Props<Debounce> { | |
| time: number; | |
| handler: string; | |
| } | |
| export class Debounce extends React.Component<DebounceProps> {} | |
| } |
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
| export function flatten<T>(array: T[][]): T[] { | |
| return [].concat.apply([], array); | |
| } | |
| export function chunk<T>( | |
| array: T[], | |
| chunkSize: number, | |
| acc: T[][] = [] | |
| ): T[][] { | |
| return array.length > chunkSize |
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
| type MayBeBuilder() = | |
| member x.Bind(v,f) = Option.bind f v | |
| member x.Return v = Some v | |
| member x.ReturnFrom o = o | |
| let maybe = OptionBuilder() |
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 Result = | |
| type Result<'TResult, 'TError> = | |
| | Ok of 'TResult | |
| | Error of 'TError | |
| let ifNone (error : 'TError) = function | |
| | Some (o) -> Ok o | |
| | None -> Error error | |
| let map f = function |
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
| open System | |
| let divideBy bottom top = | |
| if bottom = 0 | |
| then None | |
| else Some(top/bottom) | |
| type MaybeBuilder() = | |
| member this.Bind(x, 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
| // Learn more about F# at http://fsharp.org | |
| // See the 'F# Tutorial' project for more help. | |
| open System | |
| let toInt a = | |
| match (Int32.TryParse(a)) with | |
| | (true, x) -> Some x | |
| | (false, _) -> None | |
| type MaybeBuilder() = |