This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This code is licensed under the terms of the MIT license | |
*/ | |
public static IObservable<TSource[]> ThrottleWithBuffer<TSource>( | |
this IObservable<TSource> source, TimeSpan timeout) | |
{ | |
return source.ThrottleWithBuffer(timeout, TaskPoolScheduler.Default); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MemoryInformation | |
{ | |
[DllImport("KERNEL32.DLL")] | |
private static extern int OpenProcess(uint dwDesiredAccess, int bInheritHandle, uint dwProcessId); | |
[DllImport("KERNEL32.DLL")] | |
private static extern int CloseHandle(int handle); | |
[StructLayout(LayoutKind.Sequential)] | |
private class PROCESS_MEMORY_COUNTERS | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// takes a string representing the XML and allows us to find a node and change the inner text, also shows | |
// how to set-up namespaces (note: For simplicity there's No error handling in this sample) | |
let changeValue xmlData = | |
let nameTable = NameTable() | |
let namespaceManager = XmlNamespaceManager(nameTable) | |
namespaceManager.AddNamespace("soap", "http://www.w3.org/2003/05/soap-envelope") | |
let xml = XmlDocument() | |
xml.LoadXml xmlData | |
let current = xml.SelectSingleNode("//soap:Envelope/soap:Body/someElement", namespaceManager) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let readFile (filename : string) = | |
use sr = new StreamReader(filename) | |
Encoding.ASCII.GetBytes(sr.ReadToEnd()) | |
[<EntryPoint>] | |
let main argv = | |
let byteArray = readFile argv.[0] | |
let request = WebRequest.Create("http://some-url:8080/MyService") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DelayBindingExtension : BindingBaseExtension | |
{ | |
public DelayBindingExtension() | |
{ | |
} | |
public DelayBindingExtension(PropertyPath path) | |
: base(path) | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MarkupExtensionReturnType(typeof(object))] | |
public abstract class BindingBaseExtension : MarkupExtension | |
{ | |
protected BindingBaseExtension() | |
{ | |
} | |
protected BindingBaseExtension(PropertyPath path) | |
{ | |
Path = path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec getDirectories' (di: DirectoryInfo) = | |
seq { | |
yield di | |
for sd in di.GetDirectories() do | |
yield! getDirectories' sd | |
} | |
let getDirectories path = | |
let di = new DirectoryInfo(path) | |
if not di.Exists then |