Skip to content

Instantly share code, notes, and snippets.

View jfet97's full-sized avatar
🖤
Loving programming

Andrea Simone Costa jfet97

🖤
Loving programming
View GitHub Profile
@Andarist
Andarist / gist:0294519c570a52fb14f4cdd3d589c880
Created February 23, 2023 08:49
Reverse mapped types brain dump
mapped types syntax and intro
https://www.typescriptlang.org/play?#code/C4TwDgpgBA8gRgKygXigbwFBW1AZge3wC4oBnYAJwEsA7AcwBosc4BDCkmgVwFs4IKGAL4YMoSFACSAEwg1gVUAB4AKgD4U6ZtgDaAaSi0oAawgh8uKCoC6JFfuvDR46AGVWPaKhlyFy+AhqGAD0wTgAegD8omLg0AAKFPg8VKRUuCCqGqiYOFD6hjQmZhZWtlAAFACUKBqJyakQqg5BIrES9SlpuFQQ0pqdqemZAUGhEdEYsgDGADbs0NP4NORQFGDTJIPdvdKiSyvAeFzAXBReaxsAdGwU1SFheU-PUFGiuCdnEFfAABZyFQqADdWLMasgNLkcCDZtooOM3kIqkA
a tweet that prompted the idea for the talk
https://twitter.com/kentcdodds/status/1608187990215655424
but since this isn't possible with satisfies (it doesn't participate in inference, in an example like that it only provides contextual types) the answer was to use a function with a reverse mapped type
@gregberns
gregberns / Yoneda.md
Created November 29, 2021 07:47
Introduction to Yoneda and Coyoneda

Introduction to Yoneda and Coyoneda

Yoneda (and its duel Coyoneda) is well known in the Category Theory field and has been ported over to functional languages such as Haskell. Each have their uses - sometimes in similar scenarios, also in very different ways.

This will be a newbie's explanation of the concept, using Haskell to illustrate, without any Category Theory.

From what I've read, the Yonedas are not 'daily-drivers' (not used everyday), but rather can be pulled out when the time is right.

Uses: Both Yoneda's can be used to help speed up a program where there are many fmap with long lists or big trees involved. Coyoneda can be used if you want to create an 'interface' and build up calculations, then pass those calculations to an 'executor' to run them.

@mmenestret
mmenestret / fp_taglessfinal_explanation.md
Last active April 19, 2024 14:19
FP and tagless final - Fabio Labella

Purity and pure FP

  • purity is a syntactical property of programs, more precisely defined as referential transparency: replacing an expression for its bound value doesn't change meaning (precise definition)
  • side effects are things that break referential transparency (precise definition)
  • There's no direct connection between the concepts of IO, State and so on, and side effects. Traditionally, these things are side effectful (break referential transparency), but you can have abstractions that are pure (don't break ref.trans.)
  • Due to the above, the term purely functional programming is not an oxymoron, it makes perfect sense.
  • In haskell style pure FP, type constructors and algebras are used to represent "things that would otherwise traditionally be side effects (break ref.trans.)". We call these F[_]s effects or computational contexts for brevity. You can see for yourself how this cannot be a precise definition (especially because they could also have kind higher than * -> *, even though most famous a
@brigand
brigand / nickname.md
Created March 9, 2016 07:45
Freenode Setting Up Your Nickname

What is the recommended way to set up my IRC nickname?

Please follow these steps to set up your nick and configure your client. Check off each step to make sure it's been done:

Select a permanent, master nickname. If the nickname you want is registered but has expired, just ask a staffer and in most cases, we will be happy to drop it for you.

Please avoid using the name of a community project or trademarked entity, to avoid conflicts. Write down your password and be sure to keep the sheet of paper in a safe place.

Register your IRC nick:

@viktorkelemen
viktorkelemen / gist:3082055
Created July 10, 2012 08:35
Gource with ffmpeg
gource -1280x720 --seconds-per-day 0.1 --key --hide dirnames, -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 output.mp4