Skip to content

Instantly share code, notes, and snippets.

Robert Pickering robertpi

Block or report user

Report or block robertpi

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
@robertpi
robertpi / gist:11278941
Created Apr 25, 2014
Dns.GetHostAddresses only returns one address in mono
View gist:11278941
robert@fotnmc:~/code/BitcoinFs$ nslookup seed.bitcoin.sipa.be
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: seed.bitcoin.sipa.be
Address: 71.172.136.155
Name: seed.bitcoin.sipa.be
Address: 108.183.38.208
Name: seed.bitcoin.sipa.be
View gist:5560670
[{"Name":"Feck"},{"Name":"Arse"},{"Name":"Arse"}]
View ParkingMeterKata.fs
module ParkingMeterKata
open System
// coins accepted by the system
type Coin =
| TenCents = 10
| TwentyCents = 20
| FiftyCents = 50
| OneEuro = 100
| TwoEuro = 200
@robertpi
robertpi / gist:2964793
Created Jun 21, 2012
F# record implementing an interface
View gist:2964793
namespace MyNamespace
type IMyInterface =
abstract GetValue: unit -> string
type MyRecord =
{ MyField1: int
MyField2: string }
interface IMyInterface with
member x.GetValue() = x.MyField2
View salary.fsx
// Learn more about F# at http://fsharp.net
let rate = 0.04
let baseSalary = 100000.
let baseYear = 2011
let salaries =
Seq.unfold(fun (year, salary) ->
let nextYear, nextSalary = year + 1, salary * (1.0 + rate)
@robertpi
robertpi / solverFoundationSudoku.fs
Created Dec 12, 2010
A solves sudoku puzzels using Microsoft Solver Foundation and F#.
View solverFoundationSudoku.fs
open Microsoft.SolverFoundation.Services
open Microsoft.SolverFoundation.Common
open System.Collections.Generic
open Microsoft.SolverFoundation.SfsWrapper
// helper functions for grouping elements of the solution
let flatten (matrix:'a[,]) = matrix |> Seq.cast<'a> |> Seq.toArray
let getColumn c (matrix:_[,]) =
flatten matrix.[*,c..c]
View encapright
class A {
private List<string> myList = new List<string>();
private List<string> GetCurrentItems(){
return new List<string>(myList);
}
}
View AMethod.cs
class A {
static void AMethod(MyBase myBase) {
myBase.AMemberMethod();
}
}
View helloo.cs
string myPhrase = "Hell is round the corner where I shelter";
myPhrase = myPhrase.Replace("Hell", "Hevean");
You can’t perform that action at this time.