Skip to content

Instantly share code, notes, and snippets.

@OnurGumus
OnurGumus / Functional_excercise1.fs
Created March 6, 2020 19:19
Functional_excercise_1
open System
type ReadInput = unit -> int
type ReadInputR = unit -> Result<int,string>
type Process = int -> int
type ProcessR = Result<int,string> -> Result<int,string>
@OnurGumus
OnurGumus / sync_fusion.fs
Last active March 19, 2020 20:20
Fable-Syncfusion-Grid
module App
open Browser.Dom
open Fable.Core
open Fable.React
open Fable.React.Helpers
open Fable.Core.JsInterop
type ProgressProps =
| Percent of int
@OnurGumus
OnurGumus / elmish_test.fs
Created April 5, 2020 20:29
elmish test
open Elmish
type Model = { X : int}
let runLoop modell dispatcher =
let sub m = Cmd.ofSub (fun (d:Dispatch<int>) -> dispatcher := d; modell := m) //(fun d -> d 1)
let init () = { X = 10}, Cmd.none
@OnurGumus
OnurGumus / fable_reaction_menu.fs
Last active April 19, 2020 21:57
Fable.Reaction menu
module Client
open Fable.React
open Fable.React.Props
open FSharp.Control
open Fable.Reaction
open Fable.React
open Fable.React.Props
open Fable.Reaction
open FSharp.Control
Import-Module '/home/onur/.local/share/powershell/Modules/posh-git/1.0.0/posh-git.psd1'
Import-Module posh-fake
function prompt {
# Capture the maximum length of the prompt. If you want a longer prompt, adjust the math as necessary.
$winWidth = $host.UI.RawUI.WindowSize.Width;
$maxPromptPath = [Math]::Round($winWidth/3);
$GitPromptSettings.DefaultPromptPath.Text = ''
# In the PowerShell ISE (version 2.0 at least), $host.UI.RawUI.WindowSize.Widthis $null.
@OnurGumus
OnurGumus / tickspec_expecto_fscheck.fs
Last active May 4, 2020 12:45
tickspec expecto fscheck
module Program
open System.Reflection
open Expecto
open Expecto.ExpectoFsCheck
open System.Threading
open System
open TickSpec
let assembly = Assembly.GetExecutingAssembly()
@OnurGumus
OnurGumus / stateful_traverse_wrapped.fs
Created May 19, 2020 08:32
stateful traverse wrapped
type State<'st,'a> =
| Ok of 'a * 'st
| Error of ErrorState
and ErrorState = string
type S<'st,'a> = Stateful of ('st -> State<'st,'a>)
module Stateful =
let ret result =
module App
open FSharp.Control
open Browser.Dom
open Fable.Core
open Fable.Core.JS
open Fable.Core.JsInterop
let obs , ova = AsyncRx.mbSubject<string>()
let ova2 = ova |> AsyncRx.filter (fun s -> s.Length > 3)
let myButton = document.querySelector(".my-button") :?> Browser.Types.HTMLButtonElement
@OnurGumus
OnurGumus / asd.fs
Created June 8, 2020 11:16
asd fsharp adaptive
open FSharp.Data.Adaptive
open System
let a = cval None
let s = cval None
let d = cval None
let asd =
adaptive {
let! at = a
@OnurGumus
OnurGumus / dnd.fs
Created July 17, 2020 10:12
react gestures
module Client.App.ReactSpringDemos.SpringsDemo
open Fable.React
open Fable.React.Props
open Fun.ReactSpring
open Fun.ReactGesture
open Fable.Core.JsInterop
open Fable.Core
open Fable.Core.JS