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
open Donald | |
open System.Data.Common | |
open System.Data.SQLite | |
open System.Threading.Tasks | |
open Giraffe | |
open Giraffe.ViewEngine | |
open FsToolkit.ErrorHandling | |
open Microsoft.AspNetCore.Builder | |
[<RequireQualifiedAccess>] |
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
local xxd_dump_cmd = 'xxd -g 1 -u' | |
local xxd_cur_pos = nil | |
local function is_binary_file() | |
local filename = vim.fn.expand('%:t') | |
-- local basename = string.match(filename, "^[a-z]*$") | |
local binary_ext = { 'png', 'jpg', 'jpeg', 'out' } | |
local ext = string.match(filename, "%.([^%.]+)$") | |
if ext == nil and string.match(filename, '[a-z]+') then return true end |
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
M.autolist = function() | |
local preceding_line = vim.fn.getline(vim.fn.line(".") - 1) | |
if preceding_line:match("^%s*%d+%.%s.") then | |
local list_index = preceding_line:match("%d+") | |
print(list_index .. "t") | |
vim.fn.setline(".", preceding_line:match("^%s*") .. list_index + 1 .. ". ") | |
vim.cmd([[execute "normal \<esc>A\<space>"]]) | |
elseif preceding_line:match("^%s*%d+%.%s$") then | |
vim.fn.setline(vim.fn.line(".") - 1, "") | |
elseif preceding_line:match("^%s*[-+*]") and #preceding_line:match("[-+*].*") == 1 then |
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
#r "nuget:FParsec" | |
open FParsec | |
type AttackVector = | |
| Network | |
| AdjacentNetwork | |
| Local | |
| Physical |
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 Domain | |
open System | |
open System.Runtime.CompilerServices | |
open System.Globalization | |
[<AutoOpen>] | |
module rec Money = | |
[<Struct;IsReadOnly>] | |
type Money = private Money of decimal * Currency with |
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
#r "nuget: JavaScriptEngineSwitcher.ChakraCore.Native.win-x64" | |
#r "nuget: JavaScriptEngineSwitcher.ChakraCore, 3.18.2" | |
#r "nuget: DartSassHost, 1.0.0-preview7" | |
#r "nuget: FSharp.Control.Reactive, 5.0.5" | |
open System | |
open System.IO | |
open DartSassHost | |
open DartSassHost.Helpers | |
open JavaScriptEngineSwitcher.ChakraCore |
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
:root { | |
box-sizing: border-box; | |
} | |
*, ::before, ::after { | |
box-sizing: inherit; | |
} | |
html { | |
scroll-behavior: smooth; | |
} |
This is an example on how to use WPF and F# to do some simple physics using Verlet Integration.
The program creates a system of particles and constraints. Particles have inertia and is affected by gravity but their motion is also contrained by the constraints.
I tried to annotate the source code to help guide a developer familiar with languages like C#. If you have suggestions for how to improve it please leave a comment below.
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
(* | |
This is an F# interactive script to generate a JWT. You can use it as a reference for when you are generating JWT on | |
your server for a client, for example. It is hard coded for symmetric signing (HS256), but can be modified for | |
asymmetric signing RS256, see notes. | |
*) | |
#r "nuget: System.IdentityModel.Tokens.Jwt" | |
open System | |
open System.Text // for Encoding | |
open System.IdentityModel.Tokens.Jwt // For JwtSecurityToken (Install it from Nuget) | |
open System.Security.Claims // For Claim, ClaimTypes |
NewerOlder