This file contains hidden or 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
| //#r "Microsoft.TeamFoundation.Client" | |
| //#r "Microsoft.TeamFoundation.VersionControl.Client" | |
| //#r "Microsoft.TeamFoundation.VersionControl.Common" | |
| open Microsoft.TeamFoundation.Client | |
| open Microsoft.TeamFoundation.VersionControl.Client | |
| let tfsCheckOut filename = | |
| let workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo filename | |
| let workspace = RegisteredTfsConnections.GetProjectCollections().First() | |
| |> TfsTeamProjectCollectionFactory.GetTeamProjectCollection |
This file contains hidden or 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
| // Rx 1.0: | |
| //#r "System.CoreEx" //for interactive and scripts | |
| //#r "System.Reactive.dll" | |
| //open System | |
| //open System.Collections.Generic | |
| //Rx 2.1: | |
| #r "System.ComponentModel.Composition.dll" | |
| #r "../packages/Rx-Interfaces.2.1.30214.0/lib/Net45/System.Reactive.Interfaces.dll" | |
| #r "../packages/Rx-Core.2.1.30214.0/lib/Net45/System.Reactive.Core.dll" |
This file contains hidden or 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
| //#r "System.Xml.dll" //for scripts or interactive | |
| //#r "System.Xml.Linq.dll" | |
| open System | |
| open System.Xml.Linq | |
| open System.IO | |
| let getFiles = Directory.GetFiles("c:\\projects\\", "*.csproj", SearchOption.AllDirectories) | |
| |> Array.toSeq | |
| let getProjectInfo (fname:string) = |
This file contains hidden or 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
| //#r "System.Runtime.Serialization" | |
| //#r "FSharp.PowerPack" | |
| open Microsoft.FSharp.Control.WebExtensions | |
| open System | |
| open System.Runtime.Serialization | |
| open System.Runtime.Serialization.Json | |
| open System.Net | |
| open System.IO |
This file contains hidden or 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
| //View codebehind | |
| using System.Windows.Controls; | |
| namespace HelloApp | |
| { | |
| public partial class MainPage : UserControl | |
| { | |
| public MainPage() | |
| { | |
| // Required to initialize variables |
This file contains hidden or 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 generateHash text = | |
| let getbytes : (string->byte[]) = System.Text.Encoding.UTF8.GetBytes | |
| use algorithm = new System.Security.Cryptography.SHA512Managed() | |
| text |> (getbytes >> algorithm.ComputeHash >> System.Convert.ToBase64String) | |
| //use example: | |
| let id, time, secretkey = "1", System.DateTime.Now.ToString("yyyyMMddhhmmss"), "mysecret" | |
| generateHash (secretkey + id + time) |
This file contains hidden or 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 myTimeStamp = | |
| let zone = System.TimeZone.CurrentTimeZone.GetUtcOffset System.DateTime.Now | |
| let prefix = match (zone<System.TimeSpan.Zero) with | true -> "-" | _ -> "+" | |
| System.DateTime.UtcNow.ToString("yyyyMMddHHmmssffff") + prefix + zone.ToString("hhss"); |
This file contains hidden or 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
| //See examples: | |
| //Input: ["a";"b"] | |
| //Output: ["a"; "b"; "ab"] | |
| //Input: ["a";"b";"c";"d"] | |
| //Output: ["a"; "b"; "c"; "d"; "ab"; "ac"; "ad"; "bc"; "bd"; "cd"; "bcd"; "abc"; "abd"; "acd"; "abcd"] | |
| //Input: [1;2;5] | |
| //Output: [1; 2; 5; 3; 6; 7; 8] |
This file contains hidden or 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 REGISTRYSOFTWARE = "Software"; | |
| let REGISTRYMYPATH = "MySoftware"; | |
| let internal GetRegistryValue key = | |
| use path1 = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(REGISTRYSOFTWARE) | |
| match path1 with | |
| | null -> failwith("Access failed to registry: hklm\\"+REGISTRYSOFTWARE) | |
| | keyhklmsw -> | |
| use path2 = keyhklmsw.OpenSubKey(REGISTRYMYPATH) | |
| match path2 with |
This file contains hidden or 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
| open System | |
| open System.IO | |
| open System.Xml | |
| open System.Text | |
| open System.Net | |
| open System.Globalization | |
| let makeUrl symbol (dfrom:DateTime) (dto:DateTime) = | |
| //Uses the not-so-known chart-data: | |
| let monthfix (d:DateTime)= (d.Month-1).ToString() |