Skip to content

Instantly share code, notes, and snippets.

View mwadams's full-sized avatar

Matthew Adams mwadams

View GitHub Profile
ISomeService someTasks = new MyService();
var result = await Retriable.RetryAsync(
async delegate
{
var response = await someTasks.FirstTaskAsync();
return await someTasks.SecondTaskAsync(response);
});
@mwadams
mwadams / gist:5631346
Last active December 17, 2015 15:19
Retriable Async method sampe
private static async Task RunAsync()
{
ISomeService someTasks = new MyService();
var result = await Retriable.RetryAsync(() => SomeFuncAsync(someTasks));
}
private static async Task<string> SomeFuncAsync(ISomeService someTasks)
{
var response = await someTasks.FirstTaskAsync();
return await someTasks.SecondTaskAsync(response);
@mwadams
mwadams / gist:5631329
Created May 22, 2013 22:05
Example of a RetryTask
ISomeService someTasks = new MyService();
var result = await RetryTask<string>.Factory.StartNew(
() => someTasks.SecondTask(someTasks.FirstTask()), new Count(10));
@mwadams
mwadams / gist:5631223
Created May 22, 2013 21:49
Example RetryStrategy
public class Count : RetryStrategy
{
private readonly int maxTries;
private int tryCount;
public Count()
: this(5)
{
}
@mwadams
mwadams / gist:5631180
Created May 22, 2013 21:44
A retry policy example
public class AnyException : IRetryPolicy
{
public bool CanRetry(Exception exception)
{
return true;
}
}
@mwadams
mwadams / gist:5362687
Created April 11, 2013 11:34
A set in PASCAL
if i in [1,3,5..10,15,19] then ...
@mwadams
mwadams / gist:5362674
Last active December 16, 2015 02:29
A function
let add x y = x + y
@mwadams
mwadams / gist:5362667
Created April 11, 2013 11:31
A line of F#
let answer = 1 + 1
@mwadams
mwadams / gist:5358890
Created April 10, 2013 22:07
Z80 Assembler example
; 99 Bottles of Beer program in Zilgo Z80 assembly language.
; Assembles for ZX Spectrum/Timex - change Spectrum: lines
; if porting. Help from Marko! Compiled and tested with SPIN
;
; Adapted from the Alan deLespinasse's Intel 8086 version
;
; Author: Damien Guard ; [email protected] ; www.damieng.com
org 32768
@mwadams
mwadams / gist:5309248
Created April 4, 2013 10:06
Features for Endjin's charting PoC
Endjin's 2D Charting Tool
Summary of features as of 19/11/2012
====================================
Supported platforms:
WinRT, WPF, Silverlight 5, Windows Phone 8: Identical XAML, identical features and near-identical rendering.
Chart types: