Skip to content

Instantly share code, notes, and snippets.

View pillowsoft's full-sized avatar

Brad Pillow pillowsoft

View GitHub Profile
@pillowsoft
pillowsoft / post1.8-way.ts
Created February 4, 2016 00:08
Post 1.8 way of importing React in Typescript
import React from 'react';
@pillowsoft
pillowsoft / pre1.8-way.ts
Created February 4, 2016 00:07
Pre 1.8 way of importing React in Typescript
import * as React from 'react'
@pillowsoft
pillowsoft / gist:c2cf1c3f7c9dc2ffa9a4
Created October 14, 2014 15:00
TipCalculator View Model using FSharp.ViewModule.Core
type TipCalculatorViewModel() as this =
inherit ViewModelBaseWithNavigation()
// Create our backing fields
let subTotal = this.Factory.Backing(<@ this.SubTotal @>, 0.0)
let receiptTotal = this.Factory.Backing(<@ this.ReceiptTotal @>, 0.0)
let tipPercent = this.Factory.Backing(<@ this.TipPercent @>, 15.0)
// This is only used to disable the button
let handlePaymentCommand = this.Factory.CommandSyncChecked((fun _ -> ()), (fun _ -> false))
@pillowsoft
pillowsoft / ReactivePropertyExample
Created October 6, 2014 19:31
Example code for ReactiveProperty Blog Entry
let bindSliderValueChangedTwoWayConverter<'destType> (slider:Slider) (reactiveProperty:ReactiveProperty<'destType>) (converter: DataConverter<'destType, float>) =

let disposable1 = slider.ValueChanged |> Observable.map (fun (ea) -> (slider.Value))
|> Observable.iter (fun value -> Debug.WriteLine("Slider:" + value.ToString()))
|> Observable.subscribe (fun value -> reactiveProperty.Value <- converter.ConvertBack value)
let disposable2 = reactiveProperty
|> Observable.iter (fun value -> Debug.WriteLine("Prop:" + value.ToString()))
|> Observable.subscribe (fun value -> slider.Value <- converter.Convert value)
new CompositeDisposable([ disposable1; disposable2 ])
@pillowsoft
pillowsoft / AppDelegate.fs
Created May 30, 2014 23:10
F# iOS app that gives INotifyProperty needed error (and other) work with Xamarin.Forms, AddIn 5.02 and latest FSharp (3.1 from github) on Mac
namespace TestiOS
open System
open MonoTouch.UIKit
open MonoTouch.Foundation
open System
open System.ComponentModel
open Xamarin.Forms
@pillowsoft
pillowsoft / gist:f6a5cbb6e27da4c1b266
Created May 28, 2014 23:13
Simple test of the new Xamarin.Forms using F#...works great!
namespace TestAndroid
open System
open System.ComponentModel
open Android.App
open Android.Content
open Android.OS
open Android.Runtime
open Android.Views