Skip to content

Instantly share code, notes, and snippets.

View tsimbalar's full-sized avatar

Thibaud Desodt tsimbalar

View GitHub Profile
@tsimbalar
tsimbalar / README.md
Last active March 4, 2024 01:40
Open API Diff breaking changes - GitHub Actions

I couldn't get https://github.com/evereepay/openapi-diff-action to work for me, so ended up doing it a bit more manually, by invoking directly https://github.com/quen2404/openapi-diff and generating a comment for the PR with https://github.com/actions/github-script

To do that you need :

  • the script check-openapi-diff.sh ... in my case it is in the .ci folder at the root of our repo
  • the GitHub Actions workflow openapi.yaml. It needs to be under the folder .github/workflows of the repo
  • possibly adapt some paths here and there in the openapi.yaml file
@tsimbalar
tsimbalar / json-datestring-to-date.ts
Last active June 16, 2019 11:05
An example of a helper function to map an object with ISO6801 date string properties to an object with proper Date properties
// v Scroll down to see the example first v
// v--------------------------------------v
// a mapped type that is a union of the names of properties of T that are of type string
type OnlyStringProperties<T> = { [Key in keyof T]: T[Key] extends string ? Key : never }[keyof T];
// From an original object of type T, return another object where the properties
// whose name is passed are parsed to Date
function convertStringPropertiesToDates<T, K extends OnlyStringProperties<T>>(
original: T,
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo