Skip to content

Instantly share code, notes, and snippets.

View vaporwavie's full-sized avatar

Luiz Nickel vaporwavie

View GitHub Profile
@vaporwavie
vaporwavie / use-click-outside.ts
Created April 17, 2022 03:55
Use click outside custom hook used on VFR
import { useEffect } from 'react'
type ElementRef = null | {
current: HTMLElement | null
}
function useClickOutside(ref: ElementRef, handler: any) {
useEffect(() => {
const listener = (event: any) => {
if (!ref!.current || ref!.current.contains(event.target)) {
@vaporwavie
vaporwavie / fvckimageflip.js
Created January 10, 2022 15:42
Save your meme from imgflip without having their watermark (ew)
const canvas = document.querySelector("canvas");
const canvasUrl = canvas.toDataURL();
window.location = canvas
.toDataURL("image/png")
.replace("image/png", "image/octet-stream");
@vaporwavie
vaporwavie / .zshrc
Created August 21, 2021 19:30
.zshrc.omz-uninstalled-2021-08-21_16-23-49
export ZSH="/home/vaporwavie/.oh-my-zsh"
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
source /home/vaporwavie/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_THEME="lambda-mod"
plugins=(
git
@vaporwavie
vaporwavie / .cracorc.js
Created July 31, 2021 00:51
Disable webpack code-splitting.
// craco.config.js
module.exports = {
webpack: {
configure: {
output: {
filename: 'static/js/[name].js',
},
optimization: {
runtimeChunk: false,
splitChunks: {
@vaporwavie
vaporwavie / adding-windows-into-grub.md
Created June 16, 2021 11:25
Adding Windows to your Grub loader.

Step-by-step

  • su -
  • vim /boot/grub/custom.cfg (should be a new file)
  • Add the following snippet:
#This entry should work for any version of Windows installed for UEFI booting

menuentry "Windows (UEFI)" {
 search --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi
@vaporwavie
vaporwavie / csgostatsscraping.js
Last active January 14, 2023 03:56
csgostats.gg scraping that lists your matches based on specific filters.
function getRowText(t,e){return t.querySelector(e).innerText.trim()}let csgo=document.querySelectorAll("#match-list-outer > table > tbody > tr"),csgoMatches=[...csgo].map(t=>({date:getRowText(t,"td:nth-of-type(1)"),map:getRowText(t,"td:nth-of-type(3)"),score:getRowText(t,"td:nth-of-type(4)"),kills:+getRowText(t,"td.col-stats:nth-of-type(7)"),deaths:+getRowText(t,"td.col-stats:nth-of-type(8)"),diff:+getRowText(t,"td.col-stats:nth-of-type(10)"),rating:+getRowText(t,"td:nth-last-child(2)")}));function filterMatches(t="date"){const e=Object.keys(csgoMatches[0]);if(!e.some(e=>e===t))throw Error(`Invalid filter. Try using: ${e.join(", ")}. You could also just run it without a filter.`);return csgoMatches.sort((e,o)=>o[t]-e[t])}
@vaporwavie
vaporwavie / vim_shenanigans.md
Last active June 28, 2021 11:58
some stuff I often use and forget (lol)

Navigating through files

:bf            # Go to first file.
:bl            # Go to last file
:bn            # Go to next file.
:bp            # Go to previous file.
:bw            # Close file.

Keybase proof

I hereby claim:

  • I am vaporwavie on github.
  • I am vaporwavie (https://keybase.io/vaporwavie) on keybase.
  • I have a public key ASBkKjO-CzeS1Lif-_oqg6FBCaJP-bwzJd1B-CXGhMosmwo

To claim this, I am signing this object:

@vaporwavie
vaporwavie / prepare-commit-msg
Last active December 3, 2020 01:14
Git Hook that appends your branch name within the commit message.
#!/bin/sh
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *' | sed 's:.*/::')
if [ -n "$BRANCH_NAME" ]; then
echo "$BRANCH_NAME: $(cat $1)" > $1
fi
@vaporwavie
vaporwavie / useReduxSelector.tsx
Last active June 16, 2020 18:16
Demonstração do useSelector com tipagem de state customizada.
// store.tsx
import { AppState } from 'types' // local lib
import {
useSelector as useReduxSelector, // mask useSelector first import
TypedUseSelectorHook, // declare use selector generic types
} from 'react-redux'
import { configureStore } from '@reduxjs/toolkit'
import reducer from './reducers'