Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
SteveGilham / MacTemplateOverride.targets
Created May 14, 2018 07:07
Patch to get Eto.Forms 2.4.1 building/running with dotnet build
<?xml version="1.0" encoding="UTF-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
<ItemGroup>
<AvailableItemName Include="BundleResource" />
</ItemGroup>
<PropertyGroup>
<IsMac Condition="'$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">True</IsMac>
<MacBundleName Condition="'$(MacBundleName)'==''">$(MSBuildProjectName)</MacBundleName>
// This is the .fsproj file
(*
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
@SteveGilham
SteveGilham / GladeUtil.fs
Created September 9, 2017 19:04
A worked example of how to use the `Global.RegisterWidget` facility
namespace Tinesware.GtkSharp
open System
open System.Reflection
open System.Resources
open System.Runtime.InteropServices
open Gdk
open Gtk
open Glade
@SteveGilham
SteveGilham / EasyWPF.py,
Created September 9, 2017 19:01
EasyWPF 0.3.93
"""
@version: 0.3.93.1(2014-Oct-27)
@note:
EasyGui provides an easy-to-use interface for simple GUI interaction
with a user. It does not require the programmer to know anything about
tkinter, frames, widgets, callbacks or lambda. All GUI interactions are
invoked by simple function calls that return results.
EasyWPF is an API-compatible implementation for IronPython written against
the Windows Presentation Foundation
let chunk n (source : seq<'a>) =
let makechunk (source : System.Collections.Generic.IEnumerator<'a>) n =
seq { yield source.Current
let mutable i = 0
while (i < n) && source.MoveNext() do
yield source.Current
i <- i + 1
}
seq { use enumerator = source.GetEnumerator()
while enumerator.MoveNext() do
open System.Linq
type Cell = North | East | West | Root
type Connected = { exit: Cell; West : Connected option; South : Connected option; East : Connected option }
let rows = 10
let cols = 10
let rand = System.Random()
let row () = Seq.append (Enumerable.Repeat(East, cols - 1)) (Seq.singleton Root) |> Seq.toList
open System.Linq
type Cell = North | East | Root
let rows = 10
let cols = 10
let rand = System.Random()
let row () = Seq.append (Enumerable.Repeat(East, cols - 1)) (Seq.singleton Root)
open System.Linq
type Cell = North | East | Root
let rows = 10
let cols = 10
let rand = System.Random()
let row () = (Seq.singleton Root)
|> Seq.append (Enumerable.Repeat(East, cols - 1))
Start-Transcript
$pool = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspacePool(1,1)
$save = [System.Management.Automation.Runspaces.Runspace]::DefaultRunspace
try {
[System.Management.Automation.Runspaces.Runspace]::DefaultRunspace = $null
$pool.Open()
# do stuff...
$pool.Close()
# do more stuff...
}
Start-Transcript
$pool = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspacePool(1,1)
$pool.Open()
# do stuff...
$pool.Close()
# do more stuff...
Stop-Transcript