Skip to content

Instantly share code, notes, and snippets.

View jcmrva's full-sized avatar

Josh M jcmrva

View GitHub Profile
@arialdomartini
arialdomartini / Directory.Build.props
Last active July 24, 2024 04:11
Directory.Build.props
<Project>
<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
</PropertyGroup>
</Project>
@OrionReed
OrionReed / dom3d.js
Last active July 29, 2024 19:09
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@pblasucci
pblasucci / Environment.fs
Last active June 12, 2023 19:21
One possible way to handle dependency management with F# and AvaloniaUI
(*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
@Savelenko
Savelenko / Explanation.fs
Last active September 6, 2022 11:09
Ghosts of departed proofs using F#
module Explanation
(*
So what is going on in module `ValidatedSum`? This is a more detailed explanation and a piece of guidance. The goal of
all of this is being able to define libraries with "safe" APIs. To be more precise, "safe" means that functions with
interesting preconditions can only be used (applied) such that the precondition is guaranteed to hold; it is impossible
to apply a function on inputs for which the precondition does not hold.
A well-known example is `List.head`. The precondition of applying this function to list `l` is that `l` is non-empty. If
@realvictorprm
realvictorprm / Didact.fsx
Last active February 6, 2022 15:08
F# port of the "Build your own react - Didact" tutorial
(*
F# port of https://github.com/pomber/didact
Copyright © 2022 Victor Peter Rouven Müller
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FRO
@mrange
mrange / README.md
Last active January 20, 2022 20:33
Parsers combinators with F#6

Parsers combinators with F#6 [<InlineIfLambda>]

Thanks to manofstick peer reviewing the blog post.

Full source code at github

For F# Advent 2021 I wrote a blog post exploring how F#6 [<InlineIfLambda>] can improve data pipeline performance.

I was thinking of other places where [<InlineIfLambda>] can help and decided to try to build a parser combinator library with [<InlineIfLambda>].

@mrange
mrange / README.md
Last active May 26, 2022 02:46
# F# Advent 2021 Dec 08 - Fast data pipelines with F#6

F# Advent 2021 Dec 08 - Fast data pipelines with F#6

Thanks to Sergey Tihon for running F# Weekly and F# Advent.

Thanks to manofstick for trying out the code and coming with invaluable feedback. Cistern.ValueLinq is very impressive.

TLDR; F#6 enables data pipelines with up to 15x less overhead than LINQ

There were many interesting improvements in F#6 but one in particular caught my eye, the attribute InlineIfLambda.

@davidfowl
davidfowl / .NET6Migration.md
Last active July 19, 2024 22:48
.NET 6 ASP.NET Core Migration
@chiroptical
chiroptical / babyShark.hs
Last active February 3, 2023 15:23
Baby shark as a Haskell program
{-# LANGUAGE BlockArguments #-}
module Main where
main :: IO ()
main = do
babyShark
do do do do do do babyShark
do do do do do do babyShark
do do do do do do babyShark
@0xabad1dea
0xabad1dea / copilot-risk-assessment.md
Last active September 11, 2023 10:21
Risk Assessment of GitHub Copilot

Risk Assessment of GitHub Copilot

0xabad1dea, July 2021

this is a rough draft and may be updated with more examples

GitHub was kind enough to grant me swift access to the Copilot test phase despite me @'ing them several hundred times about ICE. I would like to examine it not in terms of productivity, but security. How risky is it to allow an AI to write some or all of your code?

Ultimately, a human being must take responsibility for every line of code that is committed. AI should not be used for "responsibility washing." However, Copilot is a tool, and workers need their tools to be reliable. A carpenter doesn't have to