Skip to content

Instantly share code, notes, and snippets.

View otonii's full-sized avatar
🏠
Working from home

Leandro Otoni otonii

🏠
Working from home
View GitHub Profile
@otonii
otonii / AbstractSubscribableController.ts
Last active December 5, 2023 22:38
Abstract Subscribable Controller with reducer
type Fn = (...args: any[]) => any;
type Reducer = Record<string, Fn>;
type Unsubscribe = () => void;
let seed = 0;
export abstract class AbstractSubscribableController<TReducer extends Reducer> {
protected observers: Map<number, TReducer> = new Map();
subscribe(reducer: TReducer): Unsubscribe {
seed++;
@otonii
otonii / tsconfig.json
Created October 13, 2023 13:55
typescript cheat sheet
{
"compilerOptions": {
/* Base Options: */
"esModuleInterop": true,
"skipLibCheck": true,
"target": "ES2022",
"verbatimModuleSyntax": true,
"allowJs": true,
"resolveJsonModule": true,
"moduleDetection": "force",
@otonii
otonii / extract-icon.ps1
Created January 15, 2022 23:10
Extract Icon from .exe with PowerShell
Function ExtractIcon {
Param (
[Parameter(Mandatory=$true)]
[string]$folder
)
[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing') | Out-Null
md $folder -ea 0 | Out-Null
@otonii
otonii / SmoothScroll.js
Created August 7, 2020 13:19
Smooth Whell Scrolling Vanilla JS
// https://stackoverflow.com/a/47206289
function init() {
new SmoothScroll(document, 120, 12)
}
function SmoothScroll(target, speed, smooth) {
if (target === document)
target =
document.scrollingElement ||
@otonii
otonii / oh-my-posh.md
Last active November 1, 2023 14:31
oh-my-posh

oh-my-posh

Deprecated: Use https://github.com/otonii/meu-terminal, esse carinha aqui não será mais atualizado.

Terminal Image

Obter a versão mais recente da Galeria do PowerShell

Antes de atualizar o PowerShellGet, você sempre deve instalar o provedor do NuGet mais recente. Em uma sessão do PowerShell com privilégios elevados, execute os comandos a seguir.

MSYS2 + Zsh + Oh My Zsh + Theme (windows)

Instalação do Zsh + Oh My Zsh no windows sem WSL.

Instalando o MSYS2

choco install msys2 -y