Skip to content

Instantly share code, notes, and snippets.

View dbarjs's full-sized avatar
🏡
Working from home

Eduardo Barros dbarjs

🏡
Working from home
View GitHub Profile
@dbarjs
dbarjs / usePersistentQueries.ts
Last active October 1, 2023 20:15
usePersistentQuery - a @vueuse composable proposal
import type { TupleToUnion } from 'type-fest';
import type { UsePersistentQueryOptions } from './usePersistentQuery';
import { usePersistentQuery } from './usePersistentQuery';
import { useRoute } from '#vue-router';
export function usePersistentQueries<
TKeys extends readonly string[],
TReturn = Record<TupleToUnion<TKeys>, Ref<string>>,
@dbarjs
dbarjs / framerize.js
Last active September 9, 2023 16:34
Framerize.js
(function () {
'use strict';
/**
* @typedef {'warn' | 'info' | 'log' | 'error'} LoggerType
*/
/**
* @typedef {Object} UseSoundAlertOptions
* @property {number} timeBetweenPlays
@dbarjs
dbarjs / nuxt.config.ts
Last active July 6, 2023 03:53
Fix for absolute paths on builded tsconfig.json on Nuxt 3.6.0.
import { relative, resolve } from 'node:path';
export default defineNuxtConfig({
hooks: {
'prepare:types': ({ tsConfig }) => {
if (!tsConfig?.compilerOptions?.paths) {
return;
}
const rootDir = process.cwd();

🚀 A blazingly fast shell one-liner 🚀

This shell script displays all blob objects in the repository, sorted from smallest to largest.

For my sample repo, it ran about 100 times faster than the other ones found here. On my trusty Athlon II X4 system, it handles the Linux Kernel repository with its 5.6 million objects in just over a minute.

The Base Script

git rev-list --objects --all |
@dbarjs
dbarjs / DIRECTORY_LISTING_WITH_SIZES.md
Last active May 18, 2023 16:38
SH - Directory Listing with Sizes

Save the script to a file, such as directory_list_sizes.sh, and make it executable:

chmod +x directory_list_sizes.sh

To use the script, provide the target directory as an argument when running it:

./directory_list_sizes.sh /path/to/directory
@dbarjs
dbarjs / hello.js
Last active September 22, 2022 17:38
temp.js
setTimeout(() => {
console.log('hello from remote!');
}, 1000)
@dbarjs
dbarjs / index.js
Last active February 16, 2021 19:22
kill_btb21
// BIG TRETA BRASIL ELEMENT FINDER
let GHOST_PROPERTIES = [
{ property: 'overflow', value: 'hidden' },
{ property: 'left', value: '-9999px' },
{ property: 'display', value: 'none' },
];
let ANCESTOR_MAX_CHILD = 4;

Install with snap

sudo snap install docker

Add ZSH plugin:

Add this to your ~/zshrc:

plugins=(... docker)

Install Postgres

@dbarjs
dbarjs / index.js
Last active May 19, 2020 16:31
Fetch data from wcota/covid19br to Vuex
import parse from 'csv-parse/lib/sync'
import autoParse from 'auto-parse'
export const mutations = {
SET_KEYS: (state, keys) => (state.keys = keys),
SET_ENTRIES: (state, entries) => (state.entries = entries),
SET_LAST_DATE: (state, lastDate) => (state.lastDate = lastDate)
}
export const state = () => ({