Skip to content

Instantly share code, notes, and snippets.

View vhoyer's full-sized avatar
😵‍💫
kinda burnt out

Vinícius Hoyer vhoyer

😵‍💫
kinda burnt out
View GitHub Profile
@vhoyer
vhoyer / README.md
Last active August 15, 2022 23:28
Forward TERM signal to all sub-processes

Forward TERM signal to all sub-processes

It only requires you to prepend all commands with run, then if the script process is TERM, it will forward the signal to the processes you instanciated using the run command if they are still alive, if they are not, they are just ignored.

This was designed to make docker containers shutdown faster when you have a starting script to run (in this example we are running npm install and npm start), this works because when requested to stop the container, docker will send a TERM signal to the process with id 1, which is the first command ran by the CMD (CMD ["this_command_here.sh"]).

So if this script receives TERM it will forward it leading every process to shutdown, so the container can die peacefully.

// @flow
import React, { type Element } from 'react'
import Clipboard from 'clipboard'
import { useRouter } from 'next/router'
import Gitmoji from './Gitmoji'
import Toolbar from './Toolbar'
import useLocalStorage from './hooks/useLocalStorage'
import { notify } from '../../utils/notification'
@vhoyer
vhoyer / DeepObjectNoopProxy.js
Created January 5, 2022 17:53
Proxy Handler for accessing deep properties arbitrarily, like `obj.a.b.c.d.e` without getting the `cannot access a of undefined`
const exceptions = {
// map: () => {},
};
const handler = {
get(target, key) {
if (key === Symbol.toPrimitive) return () => undefined;
if (!Object.keys(target).includes(key)) {
const proxy = new Proxy(exceptions, handler);
@vhoyer
vhoyer / README.md
Last active June 30, 2021 17:23
Overly complex script to run coverage only on changed files from one branch to another (defaults to the master).

Run branch coverage

Overly complex script to run coverage only on changed files from one branch to another (defaults to the master). This makes you only run tests that are different on the current branch compared to another branch, and this only runs coverage for the files that changed also. Bear in mind that this is also overly specific to the project I was working on and it's subfolders and file structure. That said, even if it does not work for you first try (which will probably not), it should serve as a good kick start.

@vhoyer
vhoyer / lazy-google-maps.vue
Last active February 17, 2021 21:04
lazy-google-maps.vue
<template>
<component
:is="tag"
:src="mapUrl"
class="w-full h-96 animate-skeleton"
/>
</template>
<script>
export default {
@vhoyer
vhoyer / carousel.vue
Last active March 23, 2021 21:21
A functional/stateless vue component for carousel using render function with vue-awesome-swiper
@vhoyer
vhoyer / googlon.py
Last active April 21, 2019 01:12
Googlon, massanori's exercise
listaA = '''zzrr zmnc zbmclc zbrpktxj zbdbsq ztm ztvkmv zhzvm zjcrkzm zjqcbxf znngdwb
znktlpx zndtfmf zwwx zwwdsd zwvwrnn zlmtqs zldk zcjjttpt zxljnd zkf zqwb zvtnbs zdrfjwc
zgnlpgwl zgl zgqxqpvm zflwbn mmj mmksm mbzkdw mbccsd mbd mtrfm mhj mhlrmd mhcskk
mjhskxjh mjwrncd mpqxtbzb mlsm mlfmddsn mrddntg mclvp mcld mxjccgv mxqhpg mkmnwtzv mkt
mkszj mkfsfcwd mqdgvskt mqfsrwt mdz mdrgqdht mdcqlbwx mdxlzvkg mdkc mdvcfqkt mfm mfhllb
bzrznlh bzccxd bzqcnzwp bzfqkpjj bmzqtdx bmt bbzvs bbdqpvn bsb bslbmwm bhrfvh bjgllxv
bpngkf bplzzpjw bwfgzmjn blnw blx brzxg brprszrc brxk bkjcm bvrjztfm bdjxr bdnfbh
bghqpnl bfjmw bfjbs tzhqvbt tzwvbkfq tzqcvz tzd tmjlqw tbw ttjtx ttl tsmrhhtm tjpdp tjw
tjgmjzh tpppxf tplwbr tpvdrlf tnbqgv tnt twjhgcc twxcfxk tlthnhrh trzz trxl trvpx txz
tkljpkfc tqbs tvphkg tvpjwzb tdbsgf tdsbdhv tdjzcwj tgmwmsc tgtclv tgsffh tgjpq tgnq
@vhoyer
vhoyer / .gitconfig
Created August 6, 2018 16:46
configurações sussa :D
[user]
name = Vinícius Hoyer
email = estagio02@atsd.com.br
[core]
autocrlf = input
safecrlf = false
[alias]
pow = push origin HEAD
pom = pull origin master
pod = pull origin development
[alias]
pow = push origin HEAD
pom = pull origin HEAD
pod = pull origin development
co = commit
stu = status -uno
st = status
ch = checkout
lop = log --pretty=format:'%s%x3B' --since='8 hours ago'
fix = "!vim `git diff --name-only --diff-filter=U`"