Experiment with this gist in Gistlyn.
Let's start with the big guns: Discriminated Union in C#.
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace MyNamespace | |
{ | |
public class Debouncer : IDisposable | |
{ | |
private readonly CancellationTokenSource cts = new CancellationTokenSource(); | |
private readonly TimeSpan waitTime; |
Experiment with this gist in Gistlyn.
Let's start with the big guns: Discriminated Union in C#.
/* | |
Inspired by: https://medium.com/@gcanti/introduction-to-optics-lenses-and-prisms-3230e73bfcfe | |
*/ | |
using System; | |
using static System.Console; | |
public static class Program | |
{ | |
public static void Main() |
MIT License | |
Copyright (c) 2018 Noel Bundick | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
/* | |
Modified from the original https://gist.github.com/louthy/524fbe8965d3a2aae1b576cdd8e971e4 | |
- removed dependency on [language-ext](https://github.com/louthy/language-ext) | |
- separated monadic boilerplate, so you may concentrate on describing the operations and interpretation of the program | |
- removed `IO<A>.Faulted` to simplify the examples. It can be added back in straightforward manner. | |
Useful links: | |
- [John DeGoes: Beyond Free Monads - λC Winter Retreat 2017](https://www.youtube.com/watch?v=A-lmrvsUi2Y) | |
- [Free and tagless compared - how not to commit to a monad too early](https://softwaremill.com/free-tagless-compared-how-not-to-commit-to-monad-too-early) |
// Licensed to the .NET Foundation under one or more agreements. | |
// The .NET Foundation licenses this file to you under the MIT license. | |
// See the LICENSE file in the project root for more information. | |
/*============================================================ | |
** | |
** Class: StringBuilderCache | |
** | |
** Purpose: provide a cached reusable instance of stringbuilder |
param ($xml, $xsl, $output) | |
if (-not $xml -or -not $xsl -or -not $output) | |
{ | |
Write-Host "& .\Transform-Xslt.ps1 [-xml] xml-input [-xsl] xsl-input [-output] transform-output" | |
exit; | |
} | |
trap [Exception] | |
{ |
Based on https://www.gnu.org/software/make/manual/html_node/Quick-Reference.html
Directive | Description |
---|---|
define variable define variable = define variable := define variable ::= define variable += define variable ?= endef |
Define multi-line variables. |
undefine variable |
Undefining variables. |
// | |
// See https://github.com/louthy/language-ext | |
// | |
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using LanguageExt; | |
using static LanguageExt.Prelude; |
[ Update 2020-05-31: I won't be maintaining this page or responding to comments anymore (except for perhaps a few exceptional occasions). ]
Most of the terminal emulators auto-detect when a URL appears onscreen and allow to conveniently open them (e.g. via Ctrl+click or Cmd+click, or the right click menu).
It was, however, not possible until now for arbitrary text to point to URLs, just as on webpages.