Skip to content

Instantly share code, notes, and snippets.

View PabloLION's full-sized avatar
🔍
Looking for half-time job

Pablo LION PabloLION

🔍
Looking for half-time job
  • Barcelona, Spain
View GitHub Profile
@PabloLION
PabloLION / propdiff.js
Last active November 26, 2021 20:36 — forked from albertorestifo/propdiff.js
Logs change with git diff style between current and previous object
// Example usage for React class component.
// Can also it for state or non-react JS.
componentDidUpdate(prevProps) {
logUpdatedDiff(prevProps, this.props)
}
/**
* @param {object} prev: previous to compare
* @param {object} current: current to compare
* @return {void}
@PabloLION
PabloLION / TS-example-writing-produces-intersection.ts
Last active January 4, 2022 09:55
Writing produces type intersection in TS.
// https://github.com/microsoft/TypeScript/issues/47295
// https://stackoverflow.com/questions/70569105/proxy-property-in-setter-has-never-type
// https://www.typescriptlang.org/play?ts=4.6.0-dev.20220103#code/MYewdgzgLgBAtgTwPICMBWMC8MDeBYAKBhjAFc4AuGAWgEYAaQ4gQwCdWqBtBmAJnpgBmALqMiMaBxgByaWIC+AbkKFQkWAAdWIAB4IsJAKYB3GAAVtegBSJUaAfnERDUK1DYBzFwK0gNVAGtDBBAAMxgoBA1DMPhkdAEAN2YAG1JDAEpcJmIYAHoAKhJwQxhYqAALQ2cYYxBWAIgYAryc4jy8mAA1Q1YAOhhaNpgAS3CrXw1RsAjPFyz3Vi8oTknhA2S0w2Vxds6e-r5hxeXV7Q117E30ndz8-d6BwWO5lcmYZiagkPDI6NjbOhLjBrtthh1uo8YAAWYYQYwjKDACowCbnLKOO7EYCfUrSMhwaQUYbY3EySREkm5E4uM5+YGg25Y4goViGZgBJnEeQqXb5IrGCojFKlSrVUp1BpNFrgh6HACscIRSJRaL8GKpOJq+PIlL5dxpb3ODNSNypLLZHK5uS1eIpxP11NedIuG1NYMdFvZnOGPL5EIOAwAbErEcjUZMNY7bTICXrmcRDS6TVtrXdWd60zAACaGULMUgpKAOhOzJa0tZu1PmmAZq2+3l3NlQUisGZQVhm8TyBQZHaqcAQEAivopEAeKzSXx6GBUOQwacIPuEIA
const myObj = {
num: -1,
arr: [1, 2, 3],
str: '',
};
@PabloLION
PabloLION / array-push-with-proxy-set.ts
Created January 4, 2022 10:07
`array.push` will not trigger "set" method of proxy
/* This example is to show that
* array.push will not trigger "set" method of proxy
* because array is mutable.
*/
interface MyObj {
arr: number[];
}
const myObj: MyObj = { arr: [] };
@PabloLION
PabloLION / dendron-import-bug.md
Created October 29, 2022 23:56
Only to show how dendron import files in github issue

-- :: -- :: # #- #- # # # #- #- -- :: -- :: # # # # -- :: -- :: # # # # # # # #. \ ://./-/----/ '
-- :: -- :: # #- # #- ,
-- :: -- :: # # # # # # # # -- :: -- :: # # #- #/ # # #/ #- -- :: -- :: # # # # # # # # -- :: -- :: # # #/ # # #/ -- :: -- :: # # #- # # # # # # #- -- :: -- :: #- #- # #- # #-

@PabloLION
PabloLION / refactor-pattern.py
Created March 1, 2023 06:20
Refactor python double while True loop
def foo(a,b):
pass
def edit_d(a):
pass
l = 0
d= {}
# before refactor
while d:
# impl/test of https://www.youtube.com/watch?v=PoSB9HK4kxg&ab_channel=MichaelPenn
# m = \sum_{n=0}^{m-1} \sum_{k=0}^{n+1} \frac{(-1)^{k+1}}{n+1} \binom{n+1}{k} (k+1)^m
# this is from m=lim_{x->1} mx^{m-1} with the equivalent definition of
# derivative: f'(x)=ln(1+\Delta x)f(x)
from math import comb
from fractions import Fraction
from typing import Generator, Protocol
@PabloLION
PabloLION / github-next-copilot-workspace-test-report.md
Last active October 23, 2024 21:54
GitHub Next Copilot Workspace Test Report

What it canNOT do

  • create issues
  • write PR description

What it does

Experience

I read the user guide first, then tried it in some occasions.

PR In pahen/madge

  • cannot edit PR
@PabloLION
PabloLION / Guides
Created June 7, 2024 13:30
my guides for new developers
## Git
Conventional Commits
https://www.conventionalcommits.org/
## TLDR
I'll use ChatGPT to format this doc later when I need it.
@PabloLION
PabloLION / customize-chat-gpt
Created June 13, 2024 04:32
Customize ChatGPT
## What to know
This is the list of my preference (higher first)
assume I have them all installed already.
macOS
python
homebrew
zsh
bun (JS/TS)
pnpm (JS/TS)