Skip to content

Instantly share code, notes, and snippets.

View jwosty's full-sized avatar

John Wostenberg jwosty

View GitHub Profile
@jwosty
jwosty / simple.html
Last active December 19, 2019 18:48
<html>
<head>
<title>Simple html page</title>
<script>if (typeof(xyz) === "undefined") { console.log("head: xyz doesn't exist") } else { console.log("head: xyz exists") }</script>
<script>console.log('head script executed')</script>
</head>
<body>
<h1>This is a &lt;h1&gt; element</h1>
<p>This is a &lt;p&gt; element</p>
<script>if (typeof(xyz) === "undefined") { console.log("body: xyz doesn't exist") } else { console.log("body: xyz exists") }</script>
@jwosty
jwosty / splendor.fsx
Created August 6, 2019 19:14
splendor
type Color = Blue | Red | Green | White | Black
type Token = Color * int
type Bank = {balance:Token list}
type Card = {cost:Token list}
let canBuyThisOne oneBalance oneCost =
match oneBalance,oneCost with
| (bcolor,b), (ccolor,c) -> bcolor = ccolor && b>=c
[
use file = new System.IO.File.Open("foo.xml", System.IO.FileMode.Append) in
printfn "file still open"
printfn "file now closed/disposed"
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for /Users/jwostenberg/Code/FSharp/electest/StageForge.Core/StageForge.Core.fsproj...
Restoring packages for /Users/jwostenberg/Code/FSharp/electest/StageForge.Host/StageForge.Host.csproj...
Generating MSBuild file /Users/jwostenberg/Code/FSharp/electest/StageForge.Core/obj/StageForge.Core.fsproj.nuget.g.props.
Generating MSBuild file /Users/jwostenberg/Code/FSharp/electest/StageForge.Core/obj/StageForge.Core.fsproj.nuget.g.targets.
Restore completed in 724.18 ms for /Users/jwostenberg/Code/FSharp/electest/StageForge.Core/StageForge.Core.fsproj.
Generating MSBuild file /Users/jwostenberg/Code/FSharp/electest/StageForge.Host/obj/StageForge.Host.csproj.nuget.g.props.
Generating MSBuild file /Users/jwostenberg/Code/FSharp/electest/StageForge.Host/obj/StageForge.Host.csproj.nuget.g.targets.
namespace TestAddin
open System
open Mono.Addins
open Mono.Addins.Description
[<assembly: Addin(
"TestAddin",
Namespace = "TestAddin",
Version = "1.0")>]
#if run_as_bin_sh
exec fsharpi --quiet --readline- < <(cat $0) -- $*
#endif
// Downloads the paket bootstrapper in magic mode into $PWD/.paket/ .
open System
open System.IO
open System.Net
open System.Text.RegularExpressions
INFO [2018-04-02 11:12:33Z]: Starting Visual Studio 2017 for Mac 7.4.1 (build 48)
INFO [2018-04-02 11:12:33Z]: Running on Mono 5.8.1.0 (2017-10/6bf3922f3fd) (64-bit)
INFO [2018-04-02 11:12:33Z]: Operating System: Mac OS X 10.13.3
Darwin 17.4.0 Darwin Kernel Version 17.4.0
Sun Dec 17 09:19:54 PST 2017
root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
INFO [2018-04-02 11:12:34Z]: GTK: Using gtkrc from /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/gtkrc.mac-dark
Could not find `Microsoft.Build.Framework` referenced by assembly `MonoDevelop.Core, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3ead7498f347467b`.
Could not find `Microsoft.Build` referenced by assembly `MonoDevelop.Core, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3ead7498f347467b`.
Could not find `Microsoft.Build.Utilities.Core` referenced by assembly `MonoDevelop.Core, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3ead7498f347467b`.
<!--
============================================================================================================================================
/Users/jwostenberg/Code/FSharp/visualfsharp/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
============================================================================================================================================
-->
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
</PropertyGroup>
open System
open System.IO
open System.Text
let tryReadFile path = async {
if File.Exists path then
use file = File.OpenRead path
let! bytes = file.AsyncRead (int file.Length)
return Some (Encoding.UTF8.GetString bytes)
else return None }
module SecretSanta
open System
//let initConsole () =
// let clrstr = String.replicate Console.BufferWidth " "
// for _ in 1 .. Console.WindowHeight do
// Console.WriteLine clrstr
//let clearConsole () =
//Console.SetCursorPosition (0, 0)