Skip to content

Instantly share code, notes, and snippets.

@MangelMaxime
MangelMaxime / ClockTimer.fs
Last active July 8, 2016 11:17
Simple ClockTimer. Gist purpose is to ask about the window.requestAnimationFrame
namespace Squiibz
open Fable.Import.Browser
module ClockTimer =
let days = [
"Sun", "Dim"
"Mon", "Lun"
"Tue", "Mar"
@MangelMaxime
MangelMaxime / Program.fs
Created July 12, 2016 22:34
Sample about using a Result to handle Function oriented in fable
namespace Weirdbird.Jdr.Browser
module Program =
open Fable.Core
open Fable.Import.Browser
Fable.Import.Node.require.Invoke("core-js") |> ignore
type AppModel = {
@MangelMaxime
MangelMaxime / File1.fs
Created July 19, 2016 13:54
Fable : Help for Action
let load tilesheetJsonPath (callback: Action) () =
let mutable tilesheet : TilesheetJson = createEmpty<TilesheetJson>
let loadImg (tilesheet: TilesheetJson) () =
let img = document.createElement_img()
img.onload <- Func<_,_>(fun e ->
let c = document.createElement_canvas()
let ctx = c.getContext_2d()
// Set directly (no css) the width and height of the canvas
// To ensure to draw the whole image. Otherwise, the browsers seems to
@MangelMaxime
MangelMaxime / Notification.fsx
Created August 12, 2016 09:00
Used to ask a question. How to use a producer with parameters.
module Notification =
type NotificationType =
| Success
| Warning
| Danger
type Notification =
{ Id: int
Message: string
#r "../node_modules/fable-core/Fable.Core.dll"
#load "libs/Parser.fsx"
#load "Helpers.fsx"
namespace Herebris.BridgeStream
open Fable
open Fable.Import
open Fable.Import.Browser
@MangelMaxime
MangelMaxime / cmd outuput
Created August 26, 2016 12:22
Fable output from fsproj with pixi.js
[WARNING] The value 'crossorigin' is unused (L909,85-L909,96) (Fable.Import.Pixi.fs)
[WARNING] The value 'scaleMode' is unused (L909,105-L909,114) (Fable.Import.Pixi.fs)
[WARNING] The value 'renderer' is unused (L911,44-L911,52) (Fable.Import.Pixi.fs)
[WARNING] The value 'texture' is unused (L911,89-L911,96) (Fable.Import.Pixi.fs)
[WARNING] The value 'forcePowerOfTwo' is unused (L911,108-L911,123) (Fable.Import.Pixi.fs)
[WARNING] The value 'point' is unused (L912,36-L912,41) (Fable.Import.Pixi.fs)
[WARNING] The value 'v' is unused (L920,74-L920,75) (Fable.Import.Pixi.fs)
[WARNING] The value 'v' is unused (L924,74-L924,75) (Fable.Import.Pixi.fs)
[WARNING] The value 'v' is unused (L925,75-L925,76) (Fable.Import.Pixi.fs)
[WARNING] The value 'v' is unused (L926,75-L926,76) (Fable.Import.Pixi.fs)
namespace Fable.Import.KeyboardJS
open System
open Fable.Core
open Fable.Import.JS
open Fable.Import.Browser
type [<AllowNullLiteral>] KeyEvent =
abstract preventRepeat: unit -> unit
and Callback =
@MangelMaxime
MangelMaxime / fable-architecture.fs
Created September 7, 2016 18:40
RAF fable-architecture for pixi
(**
- title: Fable architecture sample
- tagline: Just a try to implement the Fable architecture over Pixi
- app-style: width:800px; margin:20px auto 50px auto;
- require-paths: `'PIXI':'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/3.0.11/pixi.min'`
- intro: Just a try to implement the Fable architecture over Pixi. This is an experimentation for the moment
*)
#r "../../node_modules/fable-core/Fable.Core.dll"
#load "../../node_modules/fable-import-pixi/Fable.Import.Pixi.fs"
(**
- title: Fable architecture sample
- tagline: Just a try to implement the Fable architecture over Pixi
- app-style: width:800px; margin:20px auto 50px auto;
- require-paths: `'PIXI':'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/3.0.11/pixi.min'`
- intro: Just a try to implement the Fable architecture over Pixi. This is an experimentation for the moment
*)
#r "../../node_modules/fable-core/Fable.Core.dll"
#load "../../node_modules/fable-import-pixi/Fable.Import.Pixi.fs"
@MangelMaxime
MangelMaxime / GeoJson.fs
Created July 15, 2017 21:46
Leaflet bindings for Fable
namespace Fable.Import
open System
open System.Text.RegularExpressions
open Fable.Core
open Fable.Import.JS
module GeoJSON =
type [<AllowNullLiteral>] GeoJsonObject =
abstract ``type``: string with get, set