Skip to content

Instantly share code, notes, and snippets.

View leonarpv's full-sized avatar
🏠
Working from home

Leonar P. leonarpv

🏠
Working from home
View GitHub Profile
@leonarpv
leonarpv / .useApolloClient.md
Created October 19, 2023 21:07 — forked from tehpsalmist/.useApolloClient.md
Refreshing Apollo subscription websocket connections with updated auth tokens

useApolloClient

The primary idea of this hook is to re-create the underlying ApolloClient being used by all of the Subscription and Query components. There is lots of talk throughout the Apollo community about how to best refresh a WebSocket connection when a new auth token is available, and this is my attempt at providing something useful, apart from middleware that seems to have issues.

Related Links

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@leonarpv
leonarpv / filterArray.js
Created March 11, 2022 15:02 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@leonarpv
leonarpv / some_test.js
Created March 11, 2021 15:33 — forked from mbrochh/some_test.js
Controlling a Stripe payent popup with Cypress.io
// for this to work you need to set `"chromeWebSecurity": false` in cypress.json
describe('Make Stripe Payment', function() {
before(function() {
cy.visit('http://localhost:3000/en/stripe/checkout/')
Cypress.Cookies.preserveOnce('sessionid')
})
it('should enter credit card details and finalise payment', function() {
cy.get('[data-test="button-FormStripeCart-PayWithCreditCard"]').click()
@leonarpv
leonarpv / GradleCheatsheet.md
Created May 11, 2020 17:32 — forked from jiffle/GradleCheatsheet.md
Cheatsheet of Gradle Commands and Config

Command Cheatsheet

  • Convert Maven build to gradle

    gradle init

  • Initialise new project folder structure (Java example)

    gradle init --type java-library