Skip to content

Instantly share code, notes, and snippets.

View VitorLuizC's full-sized avatar

Vitor L Cavalcanti VitorLuizC

View GitHub Profile

Remove Ubuntu Advantage (Pro)

I got warning messages related to a ubuntu advantage package, and it seems related to Ubuntu Pro that I didn't sign-up for.

Ubuntu Advantage (Pro) warning messages
dpkg: warning: unable to delete old directory '/var/lib/ubuntu-advantage': Directory not empty
dpkg: warning: unable to delete old directory '/etc/ubuntu-advantage': Directory not empty
@VitorLuizC
VitorLuizC / README.md
Created February 13, 2024 21:55
Download Tibia bosses information from their site.
@VitorLuizC
VitorLuizC / README.md
Last active September 18, 2023 16:35
Documentação de como instalar o Google Cloud CLI no Ubuntu 22.04.

Como instalar o Google Cloud CLI no Ubuntu 22.04

  1. Atualizo a lista de pacotes para não instalar versões desatualizadas:

    sudo apt update
  2. Instalo os pacotes necessários para os passos seguintes:

// @ts-check
import glob from 'glob'
/**
* @param {string} path
* @returns {Promise<string[]>}
*/
function getFiles(path) {
return new Promise((resolve, reject) => {
@VitorLuizC
VitorLuizC / README.md
Last active March 18, 2022 01:24
brazilian-values

Tarefas para a versão 1.0 do brazilian-values

  • Substituir o Yarn pelo npm
  • Substituir o bili pelo Rollup
  • Substituir o AVA pelo Jest
  • Substituir o Travis CLI pelo GitHub Actions
  • Substituir o Dockerfile por um docker-compose.yaml
  • Adicionar Prettier
  • Adicionar ESLint (com plugins para Prettier e TypeScript)
  • Refazer a arquitetura
@VitorLuizC
VitorLuizC / github-actions.d.ts
Last active February 22, 2022 05:01
The TypeScript type declarations/definitions for the available environment variables in GitHub Actions' workflows.
declare namespace NodeJS {
interface ProcessEnv {
/**
* Always set to `true`.
*/
CI: true;
/**
* The name of the action currently running, or the
* [`id`](/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsid)
import type SplitPath from './Split.js';
import test from 'ava';
type Assert<TypeA, TypeB> = [TypeB] extends [TypeA] ? true : false;
test("returns 'never' for invalid paths", (context) => {
const assertions: true[] = [
true as Assert<SplitPath<''>, never>,
true as Assert<SplitPath<'.'>, never>,
true as Assert<SplitPath<'a.'>, never>,

Sobre a definição de React.js components

React.js components podem ser definidos de diferentes formas, entre elas:

  • Como classes filhas das classes Component e PureComponent.

    import { PureComponent } from 'react';
    
    class Button extends PureComponent {
import mockNanoId from '__mocks__/mockNanoId';
import { render } from '@testing-library/react';
import Home from './Home';
describe('Home | component | integration test', () => {
beforeEach(mockNanoId);
it('renders the home page', () => {
const { container } = render(<Home />);
@VitorLuizC
VitorLuizC / 0. useIdentify.ts
Created May 26, 2021 23:22
React.js useIdentify hook that generates an unique id with really random generated numbers for each name provided.
import { useCallback, useMemo } from 'react';
import generateHash from './generateHash.js';
export type Identify = (name: string) => string;
function useIdentify(): Identify {
const ids = useMemo(() => new Map<string, string>(), []);
return useCallback((name) => {
if (!ids.has(name)) {