Skip to content

Instantly share code, notes, and snippets.

View willsam100's full-sized avatar

Sam Williams willsam100

View GitHub Profile
@willsam100
willsam100 / ViewModelBaseSimple.fs
Created August 27, 2018 18:13
F# Simple View Model Base
namespace YourNameSpaceHere
open System.ComponentModel
type ViewModelBase() =
let propertyChanged = new Event<_, _>()
interface INotifyPropertyChanged with
[<CLIEvent>]
member this.PropertyChanged = propertyChanged.Publish
@willsam100
willsam100 / ViewModelBase.fs
Last active August 27, 2018 18:17
F# ViewModel Base
namespace YourNamespaceHere
open System
open System.Collections.ObjectModel
open System.ComponentModel
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.Patterns
type ViewModelBase() =
let propertyChanged = new Event<_, _>()
let toPropName(query : Expr) =
namespace FooBarIde
{
class InsertDateHandler : CommandHandler
{
protected override void Run()
{
Document doc = IdeApp.Workbench.ActiveDocument;
try
{
@willsam100
willsam100 / MainActivity.fs
Created January 14, 2019 07:56
Android foreground Service
namespace ForegroundService
open System
open Android.App
open Android.Util
open Android.Content
open Android.OS
open Android.Runtime
open Android.Views
open Android.Widget
@willsam100
willsam100 / MainActivity.fs
Created January 14, 2019 07:58
Android Job Scheduler
namespace JobScheduleSample
open System
open Android.App
open Android.Content
open Android.OS
open Android.Runtime
open Android.Views
open Android.Widget
open Android.App.Job
@willsam100
willsam100 / Tests.fs
Created February 10, 2019 17:52
TickSpec tests
namespace FsharpMvvmCross.UITests
open System
open NUnit.Framework
open Xamarin.UITest
open Xamarin.UITest.Queries
open TickSpec
module LoginScreen =
@willsam100
willsam100 / Login.feature
Created February 10, 2019 17:54
TickSpec login feature file
Feature: Login Screen works correctly
@android_ios
Scenario 1: I can login to the app with the correct credentials
Given I enter the username admin
And I enter the password admin
When I tap login
Then I should be on the Notes screen
@willsam100
willsam100 / AppInitializer.fs
Last active February 11, 2019 18:13
TickSpec AppInitializer.fs
namespace FsharpMvvmCross.UITests
open System
open System.IO
open Xamarin.UITest
open Xamarin.UITest.Queries
open NUnit.Framework
open TickSpec
open System.Reflection
open System.Runtime.ExceptionServices
@willsam100
willsam100 / NoteService.fs
Created February 21, 2019 16:59
parseDomainType pure function example
module NotesService
open Newtonsoft.Json
open System
open FSharp.Data
// This type was used for simplicty.
type RestApiResponse = {
StatusCode:int
Body:string
Headers: Map<string,string>
@willsam100
willsam100 / NoteServiceTests.fs
Created February 21, 2019 17:16
Testing parseDomainType
namespace FsharpMvvmCross.Tests
open System
open NUnit.Framework
open FsUnit
open FSharp.Data
open FsharpMvvmCross
[<TestFixture>]
type NoteServiceTests() =