Skip to content

Instantly share code, notes, and snippets.

View brunos3d's full-sized avatar
📜
<script>alert('Hello, World!')</script>

Bruno Silva brunos3d

📜
<script>alert('Hello, World!')</script>
View GitHub Profile
@brunos3d
brunos3d / javascript_destructuring.js
Last active January 15, 2020 14:19
ES6 - 3 Formas de desestruturar um objeto com javascript
var objeto = { tamanho: 10, nome: undefined, peso: 180 };
// =========================================== exemplo 1
// "desmembramento manual" =[
var size = objeto.tamanho;
var name = objeto.nome || "Bruno";
var weight = objeto.peso;
// Discord all events!
// A quick and dirty fleshing out of the discord.js event listeners (not tested at all!)
// listed here -> https://discord.js.org/#/docs/main/stable/class/Client
// Learn from this, do not just copy it mofo!
//
// Saved to -> https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584
/*
koad-was-here
[/]
appicon-margin=0
appicon-padding=5
available-monitors=[0]
desktop-line-use-custom-color=false
dot-color-1='#5294e2'
dot-color-2='#5294e2'
dot-color-3='#5294e2'
dot-color-4='#5294e2'
dot-color-dominant=true

Valores

// string
"Essa é uma string"
'Essa é outra string'
`Adivinha só?! Mais uma string!`

// boolean
true
@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', ''));
@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 / 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 / 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 / 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
// =&gt; 3 4