Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / lua.vm.js-counter.lua
Created June 14, 2016 10:48
Comparing Startlight & lua.vm.js implementation of counter
window = js.global
document = window.document
local counter = 0
local ui = {
button_substract = document:querySelector('.substract'),
button_reset = document:querySelector('.reset'),
button_add = document:querySelector('.add'),
result = document:querySelector('.result')
Information:Gradle tasks [:app:assembleAllDebug]
:app:copyArm64-v8aDebugAllKoreSharedLibraryGdbServer UP-TO-DATE
:app:createArm64-v8aDebugAllKoreSharedLibraryGdbsetup
:app:compileArm64-v8aDebugAllKoreSharedLibraryKoreMainC UP-TO-DATE
:app:compileArm64-v8aDebugAllKoreSharedLibraryKoreMainCpp
:app:linkArm64-v8aDebugAllKoreSharedLibrary
:app:stripSymbolsArm64-v8aDebugAllKoreSharedLibrary
:app:arm64-v8aDebugAllKoreSharedLibrary
:app:copyArmeabi-v7aDebugAllKoreSharedLibraryGdbServer UP-TO-DATE
:app:createArmeabi-v7aDebugAllKoreSharedLibraryGdbsetup
@MangelMaxime
MangelMaxime / BaseComponent.hx
Created January 7, 2016 20:06
Gist for describing problem with several image
package ui.components;
import ui.CursorStyle;
import kha.input.Mouse;
import kha.Framebuffer;
import kha.graphics2.Graphics;
import ui.geom.Rectangle;
import ui.geom.Point;
import kha.Color;
module ItemTask where
import Time exposing (..)
import CommonTypes exposing (ID)
import Json.Encode
import Json.Decode
import Json.Decode exposing ((:=))
-- MODEL
@MangelMaxime
MangelMaxime / user.behaviors.clj
Created November 5, 2015 08:19
Light Table behaviors for holpon
;; User behaviors
;; -----------------------------
;; Behaviors are stored as a set of diffs that are merged together
;; to create the final set of functionality that makes up Light Table. You can
;; modify these diffs to either add or subtract functionality.
;;
;; Behaviors are added to tags, objects with those tags then automatically gain
;; whatever logic the behavior imparts. To see a list of user-level behaviors,
;; start typing a word related to the functionality you want in between the square
;; brackets (e.g. "theme").
@MangelMaxime
MangelMaxime / user.keymap.clj
Last active November 5, 2015 17:55
Light Table keymap (Azerty french keyboard)
;; User keymap
;; -----------------------------
;; Keymaps are stored as a set of diffs that are merged together to create
;; the final set of keys. You can modify these diffs to either add or
;; subtract bindings.
;;
;; Like behaviors, keys are bound by tag. When objects with those tags are active
;; the key bindings are live. Keys can be bound to any number of Light Table commands,
;; allowing you the flexibility to execute multiple operations together. To see a list
;; of all the commands you can execute, start typing a word related to the thing you