Skip to content

Instantly share code, notes, and snippets.

Florian Verdonck nojaf

Block or report user

Report or block nojaf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Hookrouter.fs
module Hookrouter
open Fable.Core
open Fable.Core.JsInterop
open Fable.React
open Fable.React.Props
open System.Text.RegularExpressions
type InterceptedPath =
string option
@nojaf
nojaf / GraphQL.fs
Created Jul 15, 2019
Boilerplate for GraphQL F# implementation.
View GraphQL.fs
module GraphQL.Web
open Microsoft.AspNetCore.Http
open System.IO
open Ronnies.Server.Schema
open Microsoft.AspNetCore.Authentication.JwtBearer
open Microsoft.AspNetCore.Authentication
open FSharp.Data.GraphQL.Execution
open Newtonsoft.Json
open Newtonsoft.Json.Linq
@nojaf
nojaf / App_1.fsx
Last active Jun 19, 2019
Fable Hello world in 2019
View App_1.fsx
#load ".paket/load/main.group.fsx"
printfn "Fable compiled this"
@nojaf
nojaf / console.js
Created Mar 1, 2018
Temptation Island
View console.js
var vs = document.querySelectorAll("video"); for(let i = 0;i< vs.length;i++){ vs.item(i).playbackRate = 1.4; }
@nojaf
nojaf / main.fs
Created Feb 20, 2018
F# Cheatsheet
View main.fs
// Alias tuple
type XmlAddition =
| XmlElementAddition of parent: XPath * childNodeIndex:int * element: XElement
| XmlTextAddition of parent:XPath * textContent: string
| XmlAttributeAddition of node:XPath * attributeName:string * attributeValue:string
@nojaf
nojaf / script.fsx
Created Jan 12, 2018
List of options to list of value
View script.fsx
[Some 7; None; Some 6; Some 5]
|> List.choose id
// [7;6;5]
@nojaf
nojaf / index.html
Created Dec 21, 2017
Basic html structure
View index.html
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge"> <!-- † -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Page Title</title>
</head>
<body>
</body>
</html>
@nojaf
nojaf / subPath.fsx
Last active Aug 26, 2019
Suave subPath
View subPath.fsx
open System
open Suave
open Suave.Filters
let subPath path (ctx:HttpContext) =
async {
let localPath = ctx.request.url.LocalPath
let result =
match (localPath.StartsWith(path)) with
| false -> None
@nojaf
nojaf / index.js
Created Nov 24, 2017
Simple node server
View index.js
const http = require('http')
const port = 3000
const requestHandler = (request, response) => {
console.log(request.url)
response.end('Hello Node.js Server!')
}
const server = http.createServer(requestHandler)
@nojaf
nojaf / mapPartition.fs
Created Oct 2, 2017
Split Result list into oks and errors
View mapPartition.fs
let mapPartition (partitioner : 'T -> Result<'U1, 'U2>) list : 'U1 list * 'U2 list =
// OPTIMIZATION : If the input list is empty, immediately return empty results.
if List.isEmpty list then
[], []
else
// Mutable variables are used here instead of List.fold for maximum performance.
let mutable list = list
let mutable resultList1 = []
You can’t perform that action at this time.