Skip to content

Instantly share code, notes, and snippets.

View gnomex's full-sized avatar

Kenner Kliemann gnomex

View GitHub Profile
@gnomex
gnomex / conventional-comments.md
Last active December 28, 2023 19:40 — forked from pauloportella/conventional-comments.md
How to setup conventional comments on Github

Conventional comments

Fonte

Você pode adicionar todos os marcadores de convenções de comentários no Github como mensagens salvas seguindo os passos:

  1. Vá para https://github.com/settings/replies
  2. Abra o Developer Tools 2.1 digite allow paste para conseguir colar o script lá
  3. Copie o código abaixo e cole no console
  4. Presione enter, aguarde e recarregue a página
@gnomex
gnomex / vscode_rubocop.sh
Created October 5, 2021 13:09
Fix ruby-rubocop vscode
# FROM https://github.com/misogi/vscode-ruby-rubocop/issues/23
mkdir -p ~/.vscode/bin
cat <<'EOT' > ~/.vscode/bin/rubocop
#!/bin/bash
export PATH="$PATH:~/.rvm/bin"
source ~/.rvm/scripts/rvm
import { createContext, useEffect, useState, ReactNode } from 'react';
import { api } from '../services/api';
interface Transaction {
id: number,
title: string
}
interface TransactionsProviderProps {
children: ReactNode
@gnomex
gnomex / user_story.md
Last active September 3, 2020 13:08
User Story Template

US Nome

Como um usuário, eu [posso/gostaria/devo] fazer, para que tenha resultado

Como um papel, eu quero meta/desejo de modo que benefício Como um papel, eu quero meta/desejo A fim de receber benefício como um papel, eu quero meta/desejo Como quem quando onde, eu o que, porque por que. Como um papel, eu posso ação com o sistema para que benefício externo

Warming up --------------------------------------
with retries 2.135k i/100ms
with inject 1.882k i/100ms
with times 2.191k i/100ms
Calculating -------------------------------------
with retries 17.854k (±19.9%) i/s - 85.400k in 5.046312s
with inject 17.163k (±16.6%) i/s - 82.808k in 5.070869s
with times 19.642k (±13.4%) i/s - 96.404k in 5.034077s
Comparison:
Warming up --------------------------------------
with retries 17.117k i/100ms
with inject 18.465k i/100ms
with times 13.713k i/100ms
Calculating -------------------------------------
with retries 176.365k (± 9.8%) i/s - 872.967k in 5.043064s
with inject 160.830k (±18.2%) i/s - 775.530k in 5.071210s
with times 153.791k (±26.0%) i/s - 685.650k in 5.065556s
Comparison:
def inject_strategy(max_retries)
(1..max_retries).inject(nil) do |result, attempt_number|
begin
return yield if block_given?
rescue => e
# intentionally blank
end
end
end
(1..max_retries).inject(nil) do |result, attempt_number|
begin
# some code
rescue => e
end
end
tries ||= 0
begin
# some code
rescue => e
return if tries >= max_retries
tries += 1
retry
max_retries.times do |index|
begin
# some code
rescue => e
end
end