Skip to content

Instantly share code, notes, and snippets.

View guilhermepontes's full-sized avatar
🪁

Guilherme Pontes guilhermepontes

🪁
  • PVH Corp.
  • Amsterdam
  • 06:14 (UTC +01:00)
View GitHub Profile
@guilhermepontes
guilhermepontes / shuffle.js
Last active October 29, 2023 01:41
Shuffle Array - JavaScript ES2015, ES6
// original gist
const shuffleArray = arr => arr.sort(() => Math.random() - 0.5);
// fully random by @BetonMAN
const shuffleArray = arr => arr
.map(a => [Math.random(), a])
.sort((a, b) => a[0] - b[0])
.map(a => a[1]);
shuffleArray([1, 2, 3]) //[3, 1, 2]
const Application = ((d) => {
const privateVariable = 'Private content'
const __private = {
cache: () => {
this.link = d.querySelector('.link')
},
bind: () => {
this.link.addEventListener('click', this.showContent, false)
@guilhermepontes
guilhermepontes / 1-setup.md
Created February 13, 2023 09:02 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with a GPG Key on MacOS

Last updated September 21, 2022

This Gist explains how to do this using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

There has been a number of comments on this gist regarding some issues around the pinentry-program and M1 Macs. I've finally gotten a chance to try things out on an M1 and I've updated the documentation in 2-using-gpg.md to reflect my findings.

[
{
"name": "Composer",
"ring": "adopt",
"quadrant": "tools",
"isNew": "TRUE",
"description": "Although the idea of dependency management ..."
},
{
"name": "Canary builds",
@guilhermepontes
guilhermepontes / readme.md
Last active November 27, 2022 21:02
Get the old VSCode back on macOS

Get the old VSCode icon back!! 🔥 🔥

First download the new old icon: https://cl.ly/mzTc (based on this)

You can also use the icon you want, but you need to convert it to .icns. You can use this service to convert PNG to ICNS.

Go to Applications and find VSCode, right click there and choose Get Info. Drag 'n drop the new icon.

@guilhermepontes
guilhermepontes / script.js
Last active April 7, 2022 12:00
Remove promoted jobs LinkedIn
(() => {
let i = 0;
let d = document;
let t = 1000;
let results = '.jobs-search-results__list';
let item = '.jobs-search-results__list-item';
let footer = '.job-card-container__footer-item';
let get = (s) => d.querySelector(s);
function httpAction(action) {
const httpActionTemplate = {
type: "",
endpoint: null,
verb: "GET",
payload: null,
headers: [],
}
return {
@guilhermepontes
guilhermepontes / type.ts
Created January 14, 2020 10:20
Immutable type
type Immutable<T> = {
readonly [K in keyof T]: Immutable<T[K]>;
};
@guilhermepontes
guilhermepontes / priorityQueue.js
Last active December 18, 2019 11:43
queue data structure, javascript
function createPriorityQueue() {
const highPriorityQueue = createQueue()
const lowPriorityQueue = createQueue()
return {
enqueue(item, isHighPriority = false) {
(isHighPriority
? highPriorityQueue
: lowPriorityQueue
).enqueue(item)
@guilhermepontes
guilhermepontes / stack.js
Created November 30, 2018 10:01
stack data structure
function createStack() {
const stack = [];
return {
push(item) {
stack.push(item)
},
pop() {
return stack.pop()