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
#if INTERACTIVE | |
open System | |
open System.IO | |
Console.WriteLine "Downloading components, etc. Will take a while." | |
// Run as admin, developer command prompt or F# Interactive. e.g. "fsi myfile.fsx" | |
[<Literal>] | |
let connectionString = "Data Source=localhost; Initial Catalog=myDatabase; Integrated Security=True;" | |
let serverDir = __SOURCE_DIRECTORY__ + @"/frontend" |
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
lib/ | |
paket-files/ | |
[Pp]ackages/ |
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
FROM ubuntu:14.04 | |
RUN apt-get -y update | |
# Install Mono (and fsharp) | |
RUN apt-get -y install mono-devel autoconf pkg-config make git libtool | |
RUN git clone https://github.com/fsharp/fsharp | |
RUN cd fsharp && ./autogen.sh --prefix /usr && make && make install | |
# Add some files |
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
// In MONO, won't work in interactive, you need to make a project and compile a dll. | |
#if INTERACTIVE | |
#r @"./packages/FSharp.Data/lib/net40/FSharp.Data.dll" | |
#r @"./packages/SQLProvider/lib/net40/FSharp.Data.SqlProvider.dll" | |
// OWIN and SignalR-packages: | |
#I @"./packages/Microsoft.AspNet.SignalR.Core/lib/net45" | |
#r @"./packages/Microsoft.AspNet.SignalR.Core/lib/net45/Microsoft.AspNet.SignalR.Core.dll" | |
#I @"./packages/Microsoft.Owin/lib/net45" |
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
module Memoize | |
//More generic variant of http://www.fssnip.net/c4 | |
open System.Collections.Concurrent | |
let cache = ConcurrentDictionary<(string * obj) option,Lazy<obj>>() | |
let memoizeConcurrent (caller:string) (f: ('a -> 'b)) = | |
fun (x :'a) -> | |
(cache.GetOrAdd(Some (caller, x|>box), lazy ((f x)|>box)).Force() |> unbox) : 'b |
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
open System.IO | |
open System.Security.Cryptography | |
open System.Text | |
open System.Diagnostics.Contracts | |
let DeCryptStringWith (crypted:string) (key:string) (iv:string) = | |
let enc = new ASCIIEncoding() | |
let algo = Rijndael.Create() | |
if(crypted.Length < 5) then | |
failwith "Crypted string length has to be over 5 chars." |
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 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 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 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" // for interactive | |
// Reference to assembly System.Runtime.Serialization and System.Xml | |
open System.IO | |
open System.Runtime.Serialization.Json | |
open System.Xml | |
open System.Text | |
/// Object to Json | |
let internal json<'t> (myObj:'t) = |
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
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() |