Skip to content

Instantly share code, notes, and snippets.

void Main()
{
var result =
from g in AllGames()
let _ = Sort(g.Goals)
select new { Team1 = g.Team1, Team2 = g.Team2, Goals = g.Goals };
result.Dump();
}
// Define other methods and classes here
#nowarn "9"
module private Internals =
open System.Runtime.InteropServices
type CRED_TYPE =
| GENERIC = 1
| DOMAIN_PASSWORD = 2
| DOMAIN_CERTIFICATE = 3
#I __SOURCE_DIRECTORY__
#r "libs/NuGet.Core.dll"
#r "System.Xml.Linq"
open NuGet
open System
open System.IO
module NuGet =
let buildTrigrams (s : string) =
s
|> Seq.windowed 3
|> Seq.map (fun s -> System.String s)
|> Seq.toArray
//buildTrigrams "ABCDEFGHIJK"
let hitPercent (s : string) (tg : string array) =
let matchCount =
/// Removes Diacritics (tilde, cédille, umlaut and friends) from String
let removeDiacritics (s: string) =
s.Normalize(NormalizationForm.FormD)
|> Seq.filter (fun c -> CharUnicodeInfo.GetUnicodeCategory c <> UnicodeCategory.NonSpacingMark)
|> Seq.fold (fun (sb: StringBuilder) c -> sb.Append c) (StringBuilder())
|> string
/// <summary>Removes Diacritics (tilde, cédille, umlaut and friends) from String</summary>
public static string RemoveDiacritics(this string s)
{
string normalizedString = s.Normalize(NormalizationForm.FormD);
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < normalizedString.Length; i++)
{
char c = normalizedString[i];
if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)
(* see: http://stackoverflow.com/questions/6219726/throttled-async-download-in-f *)
open System
type ThrottlingAgentMessage<'a> =
| AddJob of Async<'a> * AsyncReplyChannel<'a>
| CompletedJob of 'a * AsyncReplyChannel<'a>
| Stop
type ThrottlingAgent<'a>(limit) =
from xy in Pois
where xy.Primarytype == "museen"
from xz in PoiDetails
where xz.PoiId == xy.Id && xz.Lang == "de"
from xw in InfoBoards
where xw.PoiDetailsId == xz.Id
select new
{
SMGId = xy.Id,
SMGPoiname = xy.Nodename,
@toburger
toburger / PropertyChangedBaseEx.fs
Created June 7, 2013 09:25
Extension method to allow the use of Quotation Expressions for NotifyPropertyChanged
[<AutoOpen>]
module PropertyChangedBaseEx
open Caliburn.Micro
open System
open System.Linq.Expressions
open Microsoft.FSharp.Linq.QuotationEvaluation
open Microsoft.FSharp.Quotations
type PropertyChangedBase with
"{0:N2} MB" -f ((((Invoke-WebRequest -uri http://localhost:8080/admin/stats -UseDefaultCredentials).Content | ConvertFrom-Json).LoadedDatabases | Measure-Object -Sum TotalDatabaseSize).Sum / 1MB)