Skip to content

Instantly share code, notes, and snippets.

View VitorLuizC's full-sized avatar

Vitor L Cavalcanti VitorLuizC

View GitHub Profile
@adalinesimonian
adalinesimonian / block-the-blue.md
Last active October 9, 2024 18:45
Block all verified Twitter accounts on screen
@iagobelo
iagobelo / Base64EncoderAndDecoder.ts
Last active June 5, 2024 13:39
Base64 encoder and decoder written with types only.
/**
* by @iagobelo
* Decoder in progress!!!
*/
type STRING_TO_CONVERT = "xablau";
type BitResult = Base64EncodeWithoutBa64Chars<STRING_TO_CONVERT>; // 011110-000110-000101-100010-011011-000110-000101-110101
type Result = Base64Encode<STRING_TO_CONVERT>; // eGFibGF1
@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)) {
@bigodel
bigodel / modular-tex-templates-with.org
Last active July 30, 2024 00:47
Contrived (La)TeX templates for Org-mode

Contrived (La)TeX templates for Org-mode

In my for ever long task of achieving Emacs and Org-mode configuration nirvana I stumbled upon the problem of trying to reuse a couple of .tex files I keep as templates for my (La)TeX exports for Org-mode. As I started to collaborate more and more in my TeX files, I realized that this setup would also need to be TeX-wise independent, that is, the exported .tex file should be self contained and self sufficient, so that I can keep collaborating and other people can see my work and (hopefully) reproduce whatever I have written without my

@tabatkins
tabatkins / pipeline.md
Last active October 17, 2022 22:40
Comparing the three pipeline proposals

We've been deadlocked for a while on the pipeline operator proposal, for a few reasons. Partially it's just low implementor interest, as this is fundamentally just syntactic sugar, but also because there are three competing proposals and the proponents of each haven't been convinced by the others yet.

In this essay I hope to briefly outline the problem space, summarize the three proposals, and talk about what's gained/lost by each of them. (Spoiler: they're all nearly identical; we're arguing over very small potatoes.)

@sindresorhus
sindresorhus / esm-package.md
Last active November 4, 2024 05:07
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@KonnorRogers
KonnorRogers / environment.js
Last active July 12, 2024 22:42
ESBuild with Webpacker < 6 in Rails. Bye Babel <3
// DONT FORGET TO `yarn add esbuild-loader` !!!
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
const { ESBuildPlugin } = require('esbuild-loader')
const esBuildUse = [
{
loader: require.resolve('esbuild-loader'),
// What you want to compile to, in this case, ES7
@sivinnguyen
sivinnguyen / wsl2_200915_fix_dns_resolution.md
Last active April 12, 2024 07:30
Fix DNS resolution in WSL2

Error

$ sudo apt-get update
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Temporary failure in name rerolution

$ host google.com
;; connection timed out; no servers could be reached
import {
EffectCallback,
DependencyList,
useLayoutEffect,
useState,
useEffect,
useMemo,
} from 'react'
// lib/canUseDOM
@graninas
graninas / What_killed_Haskell_could_kill_Rust.md
Last active July 31, 2024 07:07
What killed Haskell, could kill Rust, too

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?