Skip to content

Instantly share code, notes, and snippets.

View Luiz-Monad's full-sized avatar
💭
computing

Luiz Luiz-Monad

💭
computing
View GitHub Profile
@Luiz-Monad
Luiz-Monad / converto-hastable.ps1
Created February 21, 2020 00:43
ConvertTo-Hashtable onliner
function ConvertTo-Hashtable { process { $o = @{}; $i = $_; $i | gm -MemberType *Property | % { $o.($_.name) = $i.($_.name) }; $o } }
@Luiz-Monad
Luiz-Monad / scriptblock.ps1
Last active March 8, 2020 00:40
Powershell ScriptBlock serialization/deserialization
Function Serialize-Command
{
param(
[scriptblock]$Scriptblock
)
$rxp = '\$using:(?<var>\w+)'
$ssb = $Scriptblock.ToString()
$cb = {
@Luiz-Monad
Luiz-Monad / transcript.ps1
Created March 13, 2020 15:08
Powershell transcripting
Start-Transcript -Append -Path (Join-Path $params.Path "log-$($params.Name)-$((Get-Date).ToString('O'))")
@Luiz-Monad
Luiz-Monad / maskedinput.fs
Created March 30, 2020 14:39
React mask input
// Copyright Luiz Stangarlin 2019
module Client.Components.MaskInput
open System.Text.RegularExpressions
open FSharp.Core
open Fable.Core
open Fable.Core.JsInterop
@Luiz-Monad
Luiz-Monad / App.fs
Last active May 7, 2020 02:16
webpack server side rendering (all rights reserved)
open Browser.Types
open Browser.Dom
open Node
let private proc = Api.``process``
// Node Application Entry
let mutable runApp = null
@Luiz-Monad
Luiz-Monad / books.txt
Created May 23, 2020 15:38
list of books
https://www.cs.tufts.edu/~nr/pubs/htdp.pdf
https://www.info.ucl.ac.be/~pvr/book.html
http://www.ccs.neu.edu/home/matthias/HtDP2e/
http://www-cs-faculty.stanford.edu/~knuth/taocp.html
http://cs.brown.edu/courses/cs173/2012/book/index.html
https://sarabander.github.io/sicp/html/index.xhtml
https://www.youtube.com/watch?v=EaLboOUG9VQ&index=6&list=PLJq3XDLIJkib2h2fObomdFRZrQeJg4UIW
https://www.youtube.com/watch?v=5V1ynVyud4M
https://www.youtube.com/watch?v=R2Aa4PivG0g
https://www.youtube.com/watch?v=re96UgMk6GQ
https://www.infoq.com/presentations/Why-is-a-Monad-Like-a-Writing-Desk
https://www.youtube.com/watch?v=uVEBikEMuRQ&fref=gc
https://www.youtube.com/watch?v=PwL2c6rO6co
https://www.youtube.com/watch?v=0Eg6RDUJGJQ&fref=gc
https://www.schoolofhaskell.com/user/edwardk/bound?fref=gc
http://www.cs.ru.nl/~james/RESEARCH/haskell2004.pdf
@Luiz-Monad
Luiz-Monad / query_selector.fs
Last active July 21, 2020 13:15
graphql-less query creator
namespace Controller.Selector
open System
open log4net
open System.Linq
open System.Web.Http
open Microsoft.FSharp.Linq
open Microsoft.FSharp.Quotations
open Backend.Helpers
@Luiz-Monad
Luiz-Monad / eq.fs
Created December 22, 2020 22:03
FSharp custom equality overload
type Equality =
static member inline Mk = Unchecked.defaultof<Equality>
static member inline Eq (x: T1, y: T1) = (x.String = y.String)
static member inline Eq (x: T2, y: T2) = (x.Array = y.Array)
let inline liftEquals (c: ^C) x y =
let inline call (_: ^C, x: ^X, y: ^Y) =
((^C or ^X or ^Y): (static member Eq: 'X * 'Y -> bool) (x, y))
call (c, x, y)
@Luiz-Monad
Luiz-Monad / traverse_ShapeCombination_expr.fs
Created December 31, 2020 16:20
failed try on structural automapping
open System
open System.Reflection
open System.Collections
open Microsoft.FSharp.Reflection
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.ExprShape
open Microsoft.FSharp.Quotations.DerivedPatterns
let dump tag s = (string s).Dump(string tag); s