Skip to content

Instantly share code, notes, and snippets.

View jeroldhaas's full-sized avatar

Jerold Haas jeroldhaas

View GitHub Profile
@praeclarum
praeclarum / Dsp.cs
Created April 9, 2013 19:38
DSP functions for Xamarin.iOS bound to the Accelerate framework. See it in action by buying my Spectrogram app for iOS: https://itunes.apple.com/us/app/live-spectrogram/id630831185
using System;
using System.Runtime.InteropServices;
namespace Circuit
{
public static class Dsp
{
class FftSetupD : IDisposable
{
public IntPtr Handle;
@dealproc
dealproc / create.html
Created October 26, 2013 00:06
Durandal.JS example for running modals.
<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>
@dsyme
dsyme / gist:9b18608b78dccf92ba33
Last active November 1, 2022 18:11
Working self-contained getting-started sample for Suave Web Scripting
//==========================================
// 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.
@praeclarum
praeclarum / TableViewController.cs
Last active January 5, 2021 14:31
All the boilerplate code needed to get a custom iOS UITableViewController up and running in C#
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 ();
@bryanedds
bryanedds / Vsync.fs
Last active October 24, 2016 21:32
The 'Vsync' (AKA, 'Variable Synchronization') computation expression that coheres into the Sync comp. expr. when SYNC is #defined, and into the Async comp. expr. otherwise.
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
@7sharp9
7sharp9 / parser.fs
Last active November 19, 2015 18:18
toml fparsec
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'])
@louthy
louthy / lang-ext-option-tests.cs
Last active June 29, 2016 18:24
language-ext Option vs FSharpOption construction
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
@bryanedds
bryanedds / Assert.fs
Last active July 12, 2016 16:43
There, screw nunit.
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