Skip to content

Instantly share code, notes, and snippets.

View Peruibeloko's full-sized avatar
🍔
beesechurger

Carlinhos Peruibeloko

🍔
beesechurger
View GitHub Profile
@Peruibeloko
Peruibeloko / unthrow.ts
Created June 25, 2024 19:17
A type-safe wrapper for safely executing exception-throwing functions
function unthrow<Fn extends (...args: any) => unknown, Err = Error>(fn: Fn) {
type In = Parameters<Fn>;
type Out =
| { ok: true; data: ReturnType<Fn> }
| { ok: false; error: Err };
return (...args: In): Out => {
try {
return { ok: true, data: fn(...args) as ReturnType<Fn>};
} catch (e) {
@Peruibeloko
Peruibeloko / bucketlist.md
Last active October 22, 2023 02:40
Project list
@Peruibeloko
Peruibeloko / gruvbox.css
Created October 27, 2021 14:08
Gruvbox colors in css variables
:root {
--bg0_h: #1d2021;
--bg0_m: #282828;
--bg0_s: #32302f;
--bg1: #3c3836;
--bg2: #504945;
--bg3: #665c54;
--bg4: #7c6f64;
--gray: #928374;
--fg4: #a89984;
@Peruibeloko
Peruibeloko / .eslintrc.js
Created September 25, 2021 17:41
ESLint config for Vue 3 projects
module.exports = {
extends: 'eslint:recommended',
plugins: ['plugin:vue/vue3-recommended', 'eslint:recommended'],
env: {
es2021: true,
browser: true
},
rules: {
'arrow-parens': ['warn', 'as-needed'],
'comma-dangle': ['warn', 'never'],
@Peruibeloko
Peruibeloko / .prettierrc
Created September 25, 2021 17:32
Prettier configuration for all projects
{
"arrowParens": "avoid",
"trailingComma": "none",
"singleQuote": true,
"printWidth": 100
}
@Peruibeloko
Peruibeloko / .eslintrc.js
Last active September 25, 2021 17:46
ESLint config for Node projects
module.exports = {
extends: 'eslint:recommended',
env: {
es2021: true,
node: true,
amd: true
},
rules: {
'arrow-parens': ['warn', 'as-needed'],
'comma-dangle': ['warn', 'never'],