Skip to content

Instantly share code, notes, and snippets.

Avatar

Kamil Wojciechowski aph5nt

  • Gdynia, Poland
View GitHub Profile
View gist:0ae5d22a5ed787a7e11f
let compileScript(state : State) =
if(state.hasStartupScript = false) then Success(state, [])
else
try
if File.Exists(outputAssembly) then
File.Delete(outputAssembly)
let provider = new FSharpCodeProvider()
let params'= CompilerParameters()
params'.GenerateExecutable <- false
View gist:5dd1a866e7e2efb24bae
let findOk result item =
result
|> successTee (fun (obj, msgs) ->
let found = msgs |> List.toSeq |> Seq.tryFind (fun(m) -> m = item)
match found with
| Some msg -> msg |> should be (sameAs item)
| None -> failwith(sprintf "%s not found" item)
)
let findFailure result item =
View gist:1b24d3635df5594f097d
let initGames() =
let table = new Database.dbo.Tables.Game()
table.Clear()
table.AcceptChanges()
table.AddRow("My First Game", DateTime.UtcNow.AddHours(-1.00), DateTime.UtcNow.AddHours(1.00), DateTime.UtcNow.AddHours(2.00), Some(10000L))
table.AcceptChanges()
table.Dispose() |> ignore
ignore
@aph5nt
aph5nt / gist:aabd5a9015d4d94882ba
Created Jul 20, 2015
sql persistance configuration is not working
View gist:aabd5a9015d4d94882ba
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="akka" type="Akka.Configuration.Hocon.AkkaConfigurationSection, Akka" />
</configSections>
<akka>
<hocon>
<![CDATA[
akka {
View fs
let filter (game : Game) = game.Status = GameStatus.Refunded || game.Status = GameStatus.Completed
games
|> toSeq
|> Seq.filter(fun(k,v) -> filter v)
|> Seq.map(fun(k,v) -> v)
|> Seq.sortByDescending(fun(v) -> v.DrawingAt)
|> Seq.map (fun(v) -> toPreviousGame v)
|> Seq.toArray
View gist:8616368185202fcc58808faa82e0fb41
module Actors =
type MailBox = Eventsourced<GameCommand, obj, State>
let Logger = Serilog.Log.Logger
let update state (evnt : obj) = state
type Apply = MailBox -> State -> obj -> State
let apply : Apply = fun m s e -> s //(mailbox : MailBox) (state : State) (evnt : obj) = state
@aph5nt
aph5nt / amplify.fs
Created Aug 8, 2016
sample amplify w# binding
View amplify.fs
namespace Amplify
open WebSharper
open WebSharper.JavaScript
open WebSharper.InterfaceGenerator
open WebSharper.JQuery
module Definition =
let DefineRequestType =
@aph5nt
aph5nt / usage of amplify.fs
Created Aug 8, 2016
usage of amplify w# binding
View usage of amplify.fs
namespace Application2
open WebSharper
open WebSharper.JavaScript
open WebSharper.UI.Next
open WebSharper.UI.Next.Client
open WebSharper.UI.Next.Html
open WebSharper.JQuery
open WebSharper.Amplify
You can’t perform that action at this time.