Skip to content

Instantly share code, notes, and snippets.

View now.ps1
Function Global:Get-Now {
$CI = New-Object System.Globalization.CultureInfo("en-AU")
$Epoch = [DateTimeOffset]::UnixEpoch
$Now = [DateTimeOffset]::Now
$UnixDay = ($Now.UtcDateTime - $Epoch.UtcDateTime).Days
$UnixDaySecond = [int]$Now.UtcDateTime.TimeOfDay.TotalSeconds
$UnixSecond = $Now.ToUnixTimeSeconds()
DayOfYear = $Now.DayOfYear
Global = $Now.UtcDateTime
View .vscode launch.json
"configurations": [
"args": [],
"console": "internalConsole",
"cwd": "${workspaceFolder}",
"name": ".NET Core Launch (console)",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.0/fsql.dll",
"request": "launch",
MattMS / Fabulous WPF with VS
Last active Aug 4, 2019
Debug Fabulous WPF with VS Code
View Fabulous WPF with VS

Debugging WPF application with VS Code

The following code is based on the SqueakyApp demo using Fabulous.XamarinForms


The launch.json and tasks.json are placed inside the .vscode directory beside the sln file. These files are usually created by VS Code, but since there is not a .NET Framework option by default, you can choose the .NET Core options and edit the files after.


View WinFormsWithLayout.fs
open System
open System.Drawing
open System.Windows.Forms
let addClickHandler click (button: Button) =
button.Click.AddHandler (new EventHandler (click))
let addControl (child: Control) (parent: Control) =
parent.Controls.Add child
MattMS / BasicWinForms.fs
Last active Jul 20, 2019
Basic F# WinForms demo
View BasicWinForms.fs
open System
open System.Windows.Forms
let makeButton label click =
let button = new Button()
button.Text <- label
let clickHandler = new EventHandler(click)
button.Click.AddHandler clickHandler
MattMS / MinimumWinForms.fs
Last active Jul 24, 2019
Minimum required for a WinForms application in F# in .NET Framework 4.7
View MinimumWinForms.fs
open System
open System.Windows.Forms
Application.Run(new Form())
MattMS / paragraphs.js
Last active Jun 25, 2019
Text to HTML conversion.
View paragraphs.js
var split_p_and_br = s => s.trim().split(/\n\n/).map(s => s.replace(/\n/g, '<br />'))
var split_p = s => s.trim().split(/\n\n/).map(s => s.replace(/\n/g, ' '))
var join_p = p => p.join('</p><p>')
var fin = t => `<p>${t}</p>`
var a = `
MattMS / not_redux.js
Last active May 25, 2019
Messing around with Ramda to create a state-changing thing.
View not_redux.js
/* Example of something that is inspired by Redux, but totally not a replacement for it.
This is NOT intended to be used in anything serious; go find a proper library instead.
[MIT licensed](
So do whatever you want with any or all of this but don't blame me for anything.
Copyright 2019 Matt McKellar-Spence
const {append, cond, inc, join, lensIndex, lensPath, map, over, pathEq, pipe, prop, T, toPairs, toString} = require('ramda')
MattMS /
Created May 12, 2019
Create HTML with Python
def _add_global(name, value):
globals()[name] = value
def _replace_underscore(text):
return text.replace('_', '-')
class h:
def __init__(self, *children, **attributes):
self.attributes = attributes
self.children = children
MattMS /
Last active Mar 21, 2019
Simplify calling curried functions.


Use eat to simplify calling curried functions.

You can rewrite a(b)(c) as eat(a, b, c).


eat = (curries...)->