Skip to content

Instantly share code, notes, and snippets.

View whitetigle's full-sized avatar

Whitetigle whitetigle

View GitHub Profile
@whitetigle
whitetigle / Fable.Import.Unreal.fs
Created September 25, 2019 11:54
Unreal types for Fable
module rec Fable.Import.Unreal
open Fable.Core
open Fable.Core.JsInterop
type [<AllowNullLiteral>] Field =
inherit UObject
abstract GetMetaData: Key: string -> string
type [<AllowNullLiteral>] Enum =
@whitetigle
whitetigle / Cluster.fs
Created July 15, 2019 16:56
sample cluster that spawns new workers on crash
module Cluster
open Fable.Core
open Fable.Core.DynamicExtensions
open Node.Base
open Node.Http
open Node.Cluster
let cluster = Node.Api.cluster
let pid = Node.Api.``process``.pid
503 - "<html>\n\t<head>\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\t\t<title>Error 503: server unavailable</title>\n\t\t<style type=\"text/css\">\n\t\t\t* {\n\t\t\t\tfont-family: \"Trebuchet MS\", \"Arial\", \"Lucida grande\", \"Bitstream Charter\", \"Liberation sans\", \"FreeSans\", sans-serif;\n\t\t\t\tfont-size: 16px;\n\t\t\t\tline-height: 20px;\n\t\t\t\tcolor: #494949;\n\t\t\t\tpadding: 0;\n\t\t\t\tmargin: 0;\n\t\t\t\tfont-size: normal;\n\t\t\t\tfont-weight: 200;\n\t\t\t}\n\t\t\tbody { background-color: #F1F1F1; padding-top: 95px; }\n\t\t\t.container { padding: 0; margin: 0 auto; max-width: 737px; text-align: center; }\n\t\t\t.block { display: block; }\n\t\t\t.blue { color: #3267BF; }\n\t\t\t.regular { font-weight: 400; }\n\t\t\t.fs30 { font-size: 30px; line-height: 30px; }\n\t\t\t.fs40 { font-size: 40px; line-height: 40px; }\n\t\t\t.fs50 { font-size: 50px; line-height: 50px; }\n\t\t\t.lh45 { line-height: 45px; }\n\t\t</style>\n\t</head>\n\n\t<body>\n\t\t<div class=\"c
module rec Fable.Import.GenPass
open Fable.Core
open Fable.Import.JS
[<Import("default", from="generate-password")>]
let generator: IExports = jsNative
[<RequireQualifiedAccess>]
type IOptions =
let options = jsOptions<IOptions>(fun opt ->
opt.length <- 10
opt.symbols <- false
)
let pass = generator.generate options
type IOptions =
abstract length:int with get, set
abstract numbers:bool with get, set
abstract symbols:bool with get, set
abstract uppercase:bool with get, set
abstract excludeSimilarCharacters:bool with get, set
abstract exclude:string with get, set
abstract strict:bool with get, set
type IExports =
abstract generate: options : IOptions -> string
abstract generateMultiple: number: int * options : IOptions -> string
module rec Fable.Import.GenPass
open Fable.Core
open Fable.Import.JS
[<Import("default", from="generate-password")>]
let generator: IExports = jsNative
var generator = require('generate-password');
var passwords = generator.generateMultiple(3, {
length: 10,
uppercase: false
});
// [ 'hnwulsekqn', 'qlioullgew', 'kosxwabgjv' ]
console.log(passwords);
var generator = require('generate-password');
var password = generator.generate({
length: 10,
numbers: true
});
// 'uEyMTw32v9'
console.log(password);