Skip to content

Instantly share code, notes, and snippets.

Alan Ball voronoipotato

  • NC
Block or report user

Report or block voronoipotato

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mlDotnetIrisPrediction.fs
// Learn more about F# at http://fsharp.org
open Microsoft.ML
open Microsoft.ML.Runtime.Api
open Microsoft.ML.Trainers
open Microsoft.ML.Transforms
open System
//The first four properties are inputs, the label is what you are predicting which is set in training
type IrisData() =
[<Column("0")>] [<DefaultValue>]
View tarot.fsx
open System.IO
#I @"/lib/mono/gtk-sharp-3.0"
#r "atk-sharp.dll"
#r "gio-sharp.dll"
#r "glib-sharp.dll"
#r "gtk-sharp.dll"
#r "gdk-sharp.dll"
module Tarot =
let mutable handSize = 5
let shuffle a =
@voronoipotato
voronoipotato / Memoize.fs
Created Apr 2, 2018
Decent Memoize function in F#
View Memoize.fs
let memoize f =
let cache = ref Map.empty
fun x ->
match (!cache).TryFind(x) with
| Some res -> res
| None ->
let res = f x
cache := (!cache).Add(x,res)
res
View elmish_wpf
#r "WindowsBase"
#r "PresentationCore"
#r "PresentationFramework"
open System.Windows
open System.Windows.Controls
type Action =
| Increment
@voronoipotato
voronoipotato / base64-web-safe.js
Created Jan 23, 2018 — forked from geraintluff/base64-web-safe.js
Convert base64 to and from web-safe variant
View base64-web-safe.js
// Convert from normal to web-safe, strip trailing "="s
function webSafe64(base64) {
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
}
// Convert from web-safe to normal, add trailing "="s
function normal64(base64) {
return base64.replace(/\-/g, '+').replace(/_/g, '/') + '=='.substring(0, (3*base64.length)%4);
}
View Elmish_WPF_core.fsx
#r "WindowsBase"
#r "PresentationCore"
#r "PresentationFramework"
open System.Windows
open System.Windows.Controls
type Action =
| Increment
View Magma_and_Monoids.fsx
type Magma<'a> =
abstract member append : 'a -> 'a -> 'a
type Semigroup<'a> =
inherit Magma<'a>
type Monoid<'a> =
inherit Semigroup<'a>
abstract member empty : 'a
@voronoipotato
voronoipotato / fizzbuzz_in_DBN.fsx
Created Sep 26, 2017 — forked from paralax/fizzbuzz_in_DBN.fsx
i ported that "fizzbuzz in tensorflow" to F# and Accord.Net's DeepBeliefNetwork
View fizzbuzz_in_DBN.fsx
// i ported that "fizzbuzz in tensorflow" to F# and Accord.Net's DeepBeliefNetwork
// http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/
#r "Debug/Accord.dll"
#r "Debug/Accord.Math.dll"
#r "Debug/Accord.Neuro.dll"
#I "Debug"
open Accord.Neuro
open Accord.Neuro.Networks
View async map
async.map(myUrls, function(url, callback) {
request(url, function(error, response, html) {
// Some processing is happening here before the callback is invoked
callback(error, html);
});
}, function(err, results) {
...
});
@voronoipotato
voronoipotato / EventStoreConnectionExtensions.cs
Created Apr 24, 2017 — forked from jen20/EventStoreConnectionExtensions.cs
Quick and dirty way to hook up RX to an Event Store subscription. Emphasis on "quick" and "dirty".
View EventStoreConnectionExtensions.cs
static class EventStoreConnectionExtensions
{
public static Task<EventStoreRxSubscription> SubscribeToAll(this EventStoreConnection connection, bool resolveLinkTos)
{
return Task<EventStoreRxSubscription>.Factory.StartNew(() => {
var subject = new Subject<ResolvedEvent>();
var subscriptionTask = connection.SubscribeToAll(resolveLinkTos, subject.OnNext, () => subject.OnError(new SubscriptionDroppedException()));
subscriptionTask.Wait();
You can’t perform that action at this time.