Skip to content

Instantly share code, notes, and snippets.

@kojo12228
kojo12228 / Program.fs
Created December 28, 2021 20:27
SignalR + F# ChatHub example
open System
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.SignalR
open Microsoft.Extensions.DependencyInjection
open Microsoft.Extensions.Hosting
type ChatHub() =
inherit Hub()
member this.SendMessage(user : string, message : string) =
@kojo12228
kojo12228 / XPlotBoleroHelper.fs
Last active August 23, 2020 10:39
Working with XPlot.Plotly and Bolero (ASP.NET Blazor and F#)
namespace XPlot.Plotly.Bolero
open System.Text.RegularExpressions
open Bolero.Html
open XPlot.Plotly
[<AutoOpen>]
module BoleroHelper =
let plotToNode (chart: PlotlyChart) =
@kojo12228
kojo12228 / markdown_to_text.py
Last active March 9, 2020 21:31 — forked from lorey/markdown_to_text.py
(Flavoured) Markdown to Plaintext in Python
from bs4 import BeautifulSoup
import markdown2
def markdown_to_text(markdown_string):
""" Converts a markdown string to plaintext """
# md -> html -> text since BeautifulSoup can extract text cleanly
html = markdown2.markdown(markdown_string, extras=["fenced-code-blocks", "spoiler", "tables", "task_list"])
# remove code snippets