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
[<CompiledName("SplitAt")>] | |
let splitAt (n: int) (list: 'T list) = Microsoft.FSharp.Primitives.Basics.List.splitAt n list |
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 takeWhileFreshConsTail cons p l = | |
match l with | |
| [] -> | |
setFreshConsTail cons [] | |
| x::xs -> | |
if p x then | |
let cons2 = freshConsNoTail x | |
setFreshConsTail cons cons2 | |
takeWhileFreshConsTail cons2 p xs | |
else |
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 takeFreshConsTail cons n l = | |
match l with | |
| [] -> | |
if n <> 0 then failwith "insufficient length" | |
setFreshConsTail cons [] | |
| x::xs -> | |
if n > 0 then | |
let cons2 = freshConsNoTail x | |
setFreshConsTail cons cons2 | |
takeFreshConsTail cons2 (n - 1) xs |
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
function foo(v) { | |
var x; | |
var y; | |
function bar() { | |
return x + y; | |
} | |
if (v) { | |
x = 5; | |
return bar(); |
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
type System.Net.WebClient with | |
member inline internal this.DownloadWithWebClient(addHandler, removeHandler, extract, start) = | |
let downloadAsync = | |
Async.FromContinuations (fun (cont, econt, ccont) -> | |
let userToken = new obj() | |
let rec handler (_: obj) (args: 'T :> ComponentModel.AsyncCompletedEventArgs) = | |
if userToken = args.UserState then | |
removeHandler handle | |
if args.Cancelled then | |
ccont (new OperationCanceledException()) |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ServiceMetadataFiles> | |
<ServiceMetadataFile name="developer.atlassian.com.rpc.soap-axis.confluenceservice-v2.wsdl"> | |
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:intf="https://developer.atlassian.com/rpc/soap-axis/confluenceservice-v2" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns1="http://rpc.confluence.atlassian.com" xmlns:tns2="http://beans.soap.rpc.confluence.atlassian.com" xmlns:impl="https://developer.atlassian.com/rpc/soap-axis/confluenceservice-v2" targetNamespace="https://developer.atlassian.com/rpc/soap-axis/confluenceservice-v2" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> | |
<wsdl:types> | |
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="https://developer.atlassian.com/rpc/soap-axis/confluenceservice-v2"> | |
<import namespace="http://beans.soap.rpc.confluence.atlassian.co |
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 IEnumerable<Row> Execute(IEnumerable<Row> rows) | |
{ | |
var blockingCollection = new BlockingCollection<Row>(); | |
var count = _operations.Count; | |
if (count == 0) | |
{ | |
yield break; | |
} | |
var tasks = _operations.Select(currentOp => | |
Task.Factory.StartNew(() => |
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
// have no idea what exact type should look like | |
type Node = { Reference : int } | |
let mkArgs0 (target : Node) (source : Node) = dict ["n", box target.Reference; "m", box source.Reference] | |
// symbolic operators FTW | |
let (=>) (a : string) b = a, box b | |
let mkArgs1_1 (target : Node) (source : Node) = dict ["n" => target.Reference; "m" => source.Reference] | |
let (!) = box |
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 findPivot (myArray : int[]) i = | |
if i = 0 then | |
-1 | |
else | |
System.Diagnostics.Trace.Assert false | |
if myArray.[i] > myArray.[i-1] then i - 1 | |
else findPivot myArray (i - 1) | |
findPivot [| 1; 2; 3; 4 |] 3 |
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
// add reference to System.DirectoryServices.AccountManagement.dll | |
var sidAttr = pool.Attributes["applicationPoolSid"]; | |
var securityIdentifier = new SecurityIdentifier((string)sidAttr.Value); | |
using(var ctx = new PrincipalContext(ContextType.Machine)) | |
using(var group = GroupPrincipal.FindByIdentity(ctx, IdentityType.Sid, (string)securityIdentifier.Value)) | |
{ | |
Debug.Assert(group != null); | |
} |
OlderNewer