Skip to content

Instantly share code, notes, and snippets.

@hodzanassredin
hodzanassredin / MessagePassing.fs
Created October 11, 2012 09:55
MessagePassing in fsharp
// Learn more about F# at http://fsharp.net
// See the 'F# Tutorial' project for more help.
type MyObjectMessage =
| PrintState
| Set of int;;
let MyObject() =
let refVar = ref 0
let dispatcher = fun message ->
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@lontivero
lontivero / gist:593fc51f1208555112e0
Last active June 24, 2023 20:05
Generates Markdown from VS XML documentation file
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
namespace GithubWikiDoc
{
@dsyme
dsyme / gist:9b18608b78dccf92ba33
Last active November 1, 2022 18:11
Working self-contained getting-started sample for Suave Web Scripting
//==========================================
// Working fully self-contained getting-started example for Suave Web Server scripting
//
// Note you don't need to have _anything_ installed before starting with this script. Nothing
// but F# Interactive and this script.
//
// This script fetches the Paket.exe component which is referenced later in the script.
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been
// downloaded by the user (by executing the first part of the script) the reference
// shows as resolved and can be used.
@ruxo
ruxo / fuzzy.fsx
Last active February 9, 2023 23:18
Fuzzy logic
type CategoryFunc = float -> float
type Category = string * CategoryFunc
module private CategoryRandom =
let r = System.Random()
let from n = r.Next n
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Category =
@Thorium
Thorium / BtcPrice.fsx
Created February 2, 2017 18:14
Bitcoin current price data from blockchain.info
//Using FSharp.Data
type BtcData = FSharp.Data.JsonProvider<"""{
"USD":{"15m":1.1,"last":1.1,"buy":1.1,"sell":1.1,"symbol":"$"},
"EUR":{"15m":1.1,"last":1.1,"buy":1.1,"sell":1.1,"symbol":"€"},
"GBP":{"15m":1.1,"last":1.1,"buy":1.1,"sell":1.1,"symbol":"£"}
}""">
let prices = BtcData.Load("https://blockchain.info/ticker")
//prices.Eur.Buy : val it : decimal = 923.52M (at 02/02/2017)
//prices.Gbp.Sell : val it : decimal = 794.61M (at 02/02/2017)
@Thorium
Thorium / BtcBalance.fs
Created February 2, 2017 21:54
Get Bitcoin wallet account balance by public key
// Using FSharp.Data
type WalletData =
FSharp.Data.JsonProvider<
"""{"unspent_outputs":[{"value":9000000000},{"value":10}]}""">
let getBalance publicKey =
let balance =
try
WalletData.Load(
@sgoguen
sgoguen / _about.md
Last active November 2, 2022 13:23
A Small Elm-like DSL in F#

Making Toys with F# - A Small Elm-like DSL in F#

A Small Elm-Like DSL in F#

I've been working on a talk about the virtues of building toy examples for the purpose of communicating ideas with simple interactive examples.

The toys I talk about in my presentation are based my interest in tools that allow programmers to quickly build web applications that allow them to explore their architecture. So to kickstart this series off, I want to introduce a simple