Skip to content

Instantly share code, notes, and snippets.

View voronoipotato's full-sized avatar

Alan Ball voronoipotato

  • NC
View GitHub Profile

Keybase proof

I hereby claim:

  • I am voronoipotato on github.
  • I am voronoipotato (https://keybase.io/voronoipotato) on keybase.
  • I have a public key whose fingerprint is 72C6 923A FED0 D885 683D 68E1 47D4 E22D 1A1C F9F8

To claim this, I am signing this object:

// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "pragmatapro",
"editor.fontSize": 15,
"editor.fontLigatures": true,
"indentRainbow.colors": [
"rgba(180,237,210,.5)",
"rgba(160,207,211,.5)",
"rgba(141,148,186,.5)",
"rgba(154,122,160,.5)",
/*
let rec gcd a b =
match a, b with
| _ , 0 -> a
| _ , _ -> gcd b (a%b)
let lcm a b = a * b / (gcd a b)
*/
var arr = [1,2,3,4,5]
public class PaperTimer : IDisposable
{
private readonly Stopwatch _stopwatch;
private readonly Action<Stopwatch> _action;
public PaperTimer(Action<Stopwatch> action = null)
{
_action = action ?? (s => Console.WriteLine(s.ElapsedMilliseconds));
_stopwatch = new Stopwatch();
_stopwatch.Start();
}
@voronoipotato
voronoipotato / EventStoreConnectionExtensions.cs
Created April 24, 2017 17:46 — forked from jen20/EventStoreConnectionExtensions.cs
Quick and dirty way to hook up RX to an Event Store subscription. Emphasis on "quick" and "dirty".
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();
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 / fizzbuzz_in_DBN.fsx
Created September 26, 2017 20:56 — forked from paralax/fizzbuzz_in_DBN.fsx
i ported that "fizzbuzz in tensorflow" to F# and Accord.Net's DeepBeliefNetwork
// 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
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
#r "WindowsBase"
#r "PresentationCore"
#r "PresentationFramework"
open System.Windows
open System.Windows.Controls
type Action =
| Increment
@voronoipotato
voronoipotato / base64-web-safe.js
Created January 23, 2018 19:38 — forked from geraintluff/base64-web-safe.js
Convert base64 to and from web-safe variant
// 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);
}