Skip to content

Instantly share code, notes, and snippets.

View brunos3d's full-sized avatar
:shipit:
hunting bytes 🏹

Bruno Silva brunos3d

:shipit:
hunting bytes 🏹
View GitHub Profile
@brunos3d
brunos3d / nx-project-schema-vscode-intellisense.json
Last active July 13, 2022 18:41
How to use multiple schemas in one json file
{
"$ref": "file:../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/checkout",
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
@brunos3d
brunos3d / _error.tsx
Last active July 7, 2022 15:31
Next.js with Sentry (_error.tsx file)
import NextErrorComponent, { ErrorProps } from 'next/error';
import { captureException, flush } from '@sentry/nextjs';
import type { NextPage, NextPageContext } from 'next/types';
export interface AppErrorProps extends ErrorProps {
err?: Error;
hasGetInitialPropsRun?: boolean;
}
// ==UserScript==
// @name MacBook Chrome Optimizer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
// ==UserScript==
// @name JPG Store Optimizer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.jpg.store/collection/unwantedones*
// @icon https://www.google.com/s2/favicons?sz=64&domain=jpg.store
// @grant none
// ==/UserScript==
@brunos3d
brunos3d / for-of-with-index.md
Created November 12, 2021 14:53
Javascript FOR OF with loop index.

Javascript FOR OF with loop index.

for (const [index, value] of [1, 2, 3, 4, 5].entries()) {
  console.log(index, value);
}
// => 0 1
// => 1 2
// => 2 3
// => 3 4
@brunos3d
brunos3d / git-copy-file-from-another-branch.md
Created November 12, 2021 14:49
Git commad that copies the foo.txt file from the experiment branch to the main branch.

Copies the foo.txt file from the experiment branch to the main branch.

git switch main
git restore --source experiment -- foo.txt
@brunos3d
brunos3d / prismic-archive-all-documents.md
Created November 11, 2021 21:38
This snippet archive all prismic documents

Prismic documents archiver

Archive all prismic documents

Warnings

There are risks when using this script

⚠️ This snippet will archive all prismic documents

⚠️ Use it at your own risk

@brunos3d
brunos3d / tampermonkey-cmk-title-script.js
Created September 8, 2021 22:00
TamperMonkey CoinMarketCap Portfolio Tracker Title
// ==UserScript==
// @name CoinMarketCap Portfolio Tracker Title
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author Bruno Silva
// @match https://coinmarketcap.com/portfolio-tracker/
// @icon https://www.google.com/s2/favicons?domain=coinmarketcap.com
// @grant none
// ==/UserScript==
@brunos3d
brunos3d / Kill-The-King-Beat-Script.js
Last active May 20, 2021 19:57
Simple script that plays Kill the King automagically. https://codepen.io/jcoulterdesign/full/MWeZWxQ
document.querySelector('div.game_intro__inner.start > p').click();
setTimeout(() => {
document.querySelector('div.game_intro__inner.end > div > p.continue').click();
var lastXp = 0;
function loop() {
var stage = parseInt(document.querySelector('div.ui > div > div.ui_progress__stage').innerText.slice(6));
try {
var xp = parseInt(document.querySelector('div.game_inner__footer > div.resources > div').innerText.replace('xp', ''));