Skip to content

Instantly share code, notes, and snippets.

View gasparrobi's full-sized avatar

Robert Gaspar gasparrobi

View GitHub Profile
@gasparrobi
gasparrobi / certbot.md
Last active January 25, 2020 16:11
certbot things

THIS

To understand this binding, we have to understand the call-site: the location in code where a function is called (not where it's declared). We must inspect the call-site to answer the question: what's this this a reference to?

default binding

The first rule we will examine comes from the most common case of function calls: standalone function invocation. Think of this this rule as the default catch-all rule when none of the other rules apply.

function foo() {
	console.log( this.a );
}
@gasparrobi
gasparrobi / asyncWait.js
Created March 30, 2018 10:52
async setTimeout
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
async function main() {
console.log("waiting ....");
await wait(5000);
console.log("5 seconds have passed!");
}
main();

extract jks from PKCS12 file

keytool -importkeystore -srckeystore privateKeyFile.p12 -srcstoretype PKCS12 -destkeystore personalKeyStore.jks

debug ssl mode

@gasparrobi
gasparrobi / mp4togif.md
Last active January 19, 2018 22:07
mp4 to gif
@gasparrobi
gasparrobi / headlessChrome.md
Last active December 16, 2021 08:44
run headless chrome on digitalocean

pm2 start google-chrome
--interpreter none
--
--headless
--no-sandbox
--disable-gpu
--disable-translate
--disable-extensions
--disable-background-networking
--safebrowsing-disable-auto-update \

@gasparrobi
gasparrobi / protractorTips.md
Last active December 16, 2017 17:01
Protractor clean code and practical tips from the official documentation

async/await

  • Don’t forget to turn off control_flow, you cannot use a mix of async/await and the control flow: async/await causes the control flow to become unreliable. So if you async/await anywhere in a spec, you should set the SELENIUM_PROMISE_MANAGER: false
  • Note: To write and run native async/await test, the node.js version should be greater than or equal to 8.0, and Jasmine version should be greater than or equal to 2.7

NEVER use xpath

  • It's the slowest and most brittle locator strategy of all
  • Markup is very easily subject to change and therefore xpath locators require a lot of maintenance
  • xpath expressions are unreadable and very hard to debug
@gasparrobi
gasparrobi / headlessChrome.md
Last active March 25, 2024 09:23
headless chrome from terminal in osX

1. set an alias for chrome:

alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"

2. To remote control your chrome headless:

chrome --headless --disable-gpu --remote-debugging-port=9222