Skip to content

Instantly share code, notes, and snippets.

View JonDotsoy's full-sized avatar

Jonathan Delgado JonDotsoy

View GitHub Profile
@JonDotsoy
JonDotsoy / release.yaml
Last active June 7, 2024 14:43
This GitHub Actions workflow automates the release process. When changes are pushed to the "develop" branch, it uses Release Please to generate release notes and create a GitHub release. If a release is created, it then sets up the Node.js environment and publishes the package to npm.
on:
push:
branches:
- "develop"
name: Release
permissions:
contents: write
pull-requests: write
@JonDotsoy
JonDotsoy / DECORATE.md
Last active May 22, 2024 03:07
A Javascript utils to decorate functions

Decorate

Example

const increase = decorate(
  (n: number) => n,
  increaseBy1,
  increaseBy2,
 increaseBy3,
import { z } from "zod";
import * as fs from "fs/promise";
export class LifeConfig<T extends z.ZodObject<any>> {
bootstrapProcess: Promise<void>;
watchingProcess: null | Promise<void> = null;
store: null | z.infer<T> = null;
ready = Promise.withResolvers<null>();
subs = new Set<(state: z.infer<T>) => void>();
@JonDotsoy
JonDotsoy / unindent.spec.ts
Last active April 5, 2024 14:24
unindent to typescript
expect(
unindent`
Ok
`,
).toEqual("Ok\n");
expect(
unindent`
foo
biz
@JonDotsoy
JonDotsoy / style-text.ts
Last active April 1, 2024 14:59
styleText for typescript.
const colors: Record<string, [number, number]> = {
reset: [0, 0],
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
blink: [5, 25],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29],
@JonDotsoy
JonDotsoy / article.md
Last active September 26, 2023 14:30
How to write a Service Worker with Astro.build

How to write a service worker with Astro.build

Astro.build is a web framework for building websites, and it also enables you to create Progressive Web Apps (PWAs). One of Astro's powerful features is its ability to import and compile scripts at runtime.

Let's take a look at the following sample:

<script>
  import "../scripts/script.js"
@JonDotsoy
JonDotsoy / asconfig.json
Last active March 27, 2023 20:06
Full sample make assemblyscript with JSON transformer
{
"targets": {
"debug": {
"outFile": "build/debug.wasm",
"textFile": "build/debug.wat",
"sourceMap": true,
"debug": true
},
"release": {
"outFile": "build/release.wasm",

Deeper Shell Integration

You can use avn to deeply integrate into your shell and automatically invoke nvm when changing directories. avn is not supported by the nvm maintainers. Please report issues to the avn team.

If you prefer a lighter-weight solution, the recipes below have been contributed by nvm users. They are not supported by the nvm maintainers. We are, however, accepting pull requests for more examples.

bash

Automatically call nvm use
@JonDotsoy
JonDotsoy / git-as-ninja.md
Last active November 30, 2022 03:58
🦺 A few ideas to optimize your workflow

Git Ninja 🥷

A little guide to using git as a ninja.

🙏 No more git commit -m

The big problem to use git commit -m is the idea to write a good commit message. Some IDEs than VSCode offer a textarea to write a draft message while writing your code but if you change the branch? or change takes time in another project?

My solution to this dispersion is to write the commit message by branch. Is a good practice to write your changes in a branch distinct of development|develop and main|master and is a best good practice to write the commit with "Commits convention".