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 / buttonCreator.js
Created November 9, 2016 14:33
Criar botões em javascript
// essa função constrói e retorna o botão baseado no paramentro 'properties'
function buildButton( properties ) {
var button = document.createElement('button');
button.textContent = properties.title;
button.className = properties.className;
button.addEventListener('click', function() {
// adiciona a action aqui
@dbarjs
dbarjs / hello.js
Last active September 22, 2022 17:38
temp.js
setTimeout(() => {
console.log('hello from remote!');
}, 1000)
@dbarjs
dbarjs / Discord Of Candies.js
Last active April 4, 2022 17:22
Foi algum desafio de código escrito em 2015
this._ = this._ || {};
(function (_) {
_.a = function(a, b) {
if (a > b) return _.a((a - 1) / 2, b);
return a;
};
_.b = function(a, b) {
var c = _.a(a, b);
if (c % 1 === 0) return c;
return false;
@dbarjs
dbarjs / noibe-manifest.txt
Last active April 4, 2022 17:16
Descrição da Noibe
Com mais e mais projetos vindo parar em minhas mãos, infelizmente eu ainda não tive tempo de parar para criar um bom portal para o Noibe. Qualquer dia desse eu tome vergonha na cara e crie algo bonito aqui! XD
Se você não entendeu onde está, este é o portal principal da filosofia Noibe.
Meu nome é Eduardo Barros e eu tive a ideia de criar o Noibe em setembro de 2011, no início era apenas uma forma de unir amigos que compartilhavam o mesmo objetivo e precisavam de uma motivação a mais para alcançar o que precisavam.
Com o tempo eu participei de vários eventos e pude participar de muitas dinamicas em grupo eu acabei desenvolvendo uma forma de unir pessoas para que criassem algo totalmente inesperado, bastante efetivo e até divertido. Assim como o Ubuntu, além dos projetos de desenvolvimento de tecnologia, a palavra noibe também se refére à uma filosofia.
A palavra Noibe vem dâ famosa frase de William Shakespeare "To be or not to be" ou "Ser ou não ser, eis a questão" no português, neste caso, o 'no' seria u
@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;