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
exception AssertException of string | |
module Assert = | |
let isTrue value = | |
if not value then | |
raise (AssertException "Expected true but got false.") | |
let isFalse value = | |
if value 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
using LanguageExt; | |
using static LanguageExt.Prelude; | |
/////////////////////////////////////////////////////////////////////////////////// | |
// Option<T> doesn't allow null use at all, and it's a struct, so any references | |
// also can't be null. | |
string noValue = null; | |
Option<string> str1 = noValue; // Implicitly coerced to None | |
Option<string> str2 = Optional(noValue); // Explicitly coerced to None |
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 System | |
open System.Globalization | |
open FParsec | |
type Token = | |
| KeyGroup of string list | |
| KeyValue of string * obj | |
let (<||>) p1 p2 = attempt (p1 |>> box) <|> attempt (p2 |>> box) | |
let spc = many (anyOf [' '; '\t']) |
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 YourNamespaceHere | |
open System | |
open System.Diagnostics | |
open System.Threading | |
open System.Threading.Tasks | |
/// The 'Sync' builder for evaluating expressions in a synchronous style to aid debugging. | |
type [<Sealed>] Sync () = | |
member inline this.Bind (x, f) = f x | |
member inline this.Return x = x |
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
public class TableViewController : UITableViewController | |
{ | |
static readonly NSString CellId = new NSString ("C"); | |
readonly TableViewSource source = new TableViewSource (); | |
readonly List<string> rows = new List<string> (); | |
public override void ViewDidLoad () | |
{ | |
base.ViewDidLoad (); |
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
//========================================== | |
// Working fully self-contained getting-started example for Suave Web Server scripting | |
// | |
// Note you don't need to have _anything_ installed before starting with this script. Nothing | |
// but F# Interactive and this script. | |
// | |
// This script fetches the Paket.exe component which is referenced later in the script. | |
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been | |
// downloaded by the user (by executing the first part of the script) the reference | |
// shows as resolved and can be used. |
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
<div class="messageBox wideMessageBox"> | |
<div class="modal-header"> | |
<h3 data-bind="text: title"></h3> | |
</div> | |
<div class="modal-body"> | |
<!-- Whatever you want here to display in your modal --> | |
</div> | |
<div class="modal-footer"> | |
<!-- only because i have save/cancel bindings on my module above. --> | |
<button class="btn btn-default" data-bind="click: cancel">Cancel</button> |
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
using System; | |
using System.Runtime.InteropServices; | |
namespace Circuit | |
{ | |
public static class Dsp | |
{ | |
class FftSetupD : IDisposable | |
{ | |
public IntPtr Handle; |