Skip to content

Instantly share code, notes, and snippets.

View wakeupmh's full-sized avatar
🏴‍☠️

Marcos Henrique wakeupmh

🏴‍☠️
View GitHub Profile
@ciiqr
ciiqr / zod-optional-null.ts
Last active July 16, 2024 01:25
zod optional/nullable/nullish differences
// zod schema
z.object({
// valid if string or:
optional: z.string().optional(), // field not provided, or explicitly `undefined`
nullable: z.string().nullable(), // field explicitly `null`
nullish: z.string().nullish(), // field not provided, explicitly `null`, or explicitly `undefined`
});
// type
{
@ErickWendel
ErickWendel / concat-streams.mjs
Last active May 19, 2023 18:04
Example of how to consume multiple Web APIs in parallel via Node.js Streams
// npm i axios stream-concat
import { pipeline } from 'stream/promises'
import StreamConcat from 'stream-concat'
import axios from 'axios'
const API_01 = 'http://localhost:3000'
const API_02 = 'http://localhost:4000'
const streams = (await Promise.all([
axios({
@justinyoo
justinyoo / app-module.cs
Last active August 15, 2019 19:49
Revising Azure Functions Dependency Injection
public class AppModule : Module
{
public override void Load(IServiceCollection services)
{
services.AddSingleton<AppSettings>();
services.AddTransient<IGetSamplesFunction, GetSamplesFunction>();
}
}
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing