Skip to content

Instantly share code, notes, and snippets.

View whitetigle's full-sized avatar

Whitetigle whitetigle

View GitHub Profile
open System
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import.PIXI
open Fable.Import.Browser
type Options() =
interface RendererOptions with
member val antialias = Some(true) with get, set
@whitetigle
whitetigle / Fable.Import.Pixi.fs
Last active August 28, 2016 07:50
WIP on Pixi bindings
// Type definitions for Pixi.js 3.0.9 dev
// Project: https://github.com/GoodBoyDigital/pixi.js/
// Definitions by: clark-stevenson <https://github.com/pixijs/pixi-typescript>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
namespace Fable.Import
open System
open Fable.Core
open Fable.Import.JS
open Fable.Import.Browser
(**
- 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"
fable --projFile ./src/lab/fsm.fsx --outDir ../../out/lab -s -w --verbose
Fable F# to JS compiler version 0.6.2
PROJECT FILE: C:\Users\whitetigle\Documents\workspace\fs_press\src\lab\fsm.fsx
OUTPUT DIR: C:\Users\whitetigle\Documents\workspace\fs_press\out\lab
WORKING DIR: C:\Users\whitetigle\Documents\workspace\fs_press\src\lab
FABLE COMMAND: cmd /S /C "C:\Users\whitetigle\AppData\Roaming\npm\node_modules\fable-compiler\bin\Fable.Client.Node.exe --projFile fsm.fsx --watch true --copyExt true"
fable-compiler 0.6.2: Start compilation...
@whitetigle
whitetigle / node.fsx
Last active September 23, 2016 11:29
WIP on some functional behavior system
open System
open System.Collections.Generic
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import.PIXI
open Fable.Import.PIXI.extras
open Fable.Import.Browser
open Fable.Import.JS
let options = [
open System
open System.Collections.Generic
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import.PIXI
open Fable.Import.PIXI.extras
open Fable.Import.Browser
open Fable.Import.JS
let options = [
@whitetigle
whitetigle / sample.fsx
Created October 6, 2016 10:25
filter problem on array
// Encountered problem: Seq.filter may never stops if condition is never met.
let testA =
let max = 1000000
let a = [| for i in 1 .. max -> 100 |> int |]
console.log(a.Length)
let b = a |> Seq.filter( fun x -> x > 10) |> Seq.toArray
console.log(b.Length)
let testB =
@whitetigle
whitetigle / sonic-pi-tutorial.md
Created December 15, 2016 10:35 — forked from jwinder/sonic-pi-tutorial.md
Sonic Pi tutorials concatenated, currently from version 2.11

1 Welcome to Sonic Pi

Welcome friend :-)

Welcome to Sonic Pi. Hopefully you're as excited to get started making crazy sounds as I am to show you. It's going to be a really fun ride where you'll learn all about music, synthesis, programming, composition, performance and more.

But wait, how rude of me! Let me introduce myself - I'm

@whitetigle
whitetigle / Mapbox.fs
Last active June 12, 2017 14:58
Fable MapBox integration
// Updated version thanks to excellent post from Zaid Ajaj
// https://medium.com/@zaid.naom/f-interop-with-javascript-in-fable-the-complete-guide-ccc5b896a59f
namespace Leaflet
module L =
open Fable.Core.JsInterop
open Fable.Core
@whitetigle
whitetigle / Point.fs
Created May 23, 2017 15:41
Point class from paper.js
and [<AllowNullLiteral>] [<Import("Point","paper")>] Point(x: float,y:float) =
member __.x with get(): float = jsNative and set(v: float): unit = jsNative
member __.y with get(): float = jsNative and set(v: float): unit = jsNative
member __.length with get(): float = jsNative and set(v: float): unit = jsNative
member __.angle with get(): float = jsNative and set(v: float): unit = jsNative
member __.angleInRadians with get(): float = jsNative and set(v: float): unit = jsNative
member __.quadrant with get(): float = jsNative and set(v: float): unit = jsNative
member __.selected with get(): bool = jsNative and set(v: bool): unit = jsNative
static member min(point1: Point, point2: Point): Point = jsNative
static member max(point1: Point, point2: Point): Point = jsNative