Skip to content

Instantly share code, notes, and snippets.

View heridev's full-sized avatar
🌠
Exploring GraphQL with the Github explorer

Heriberto Magaña heridev

🌠
Exploring GraphQL with the Github explorer
View GitHub Profile
@heridev
heridev / content.md
Last active November 21, 2024 14:56
Recaptcha from google with React, how to implement it if needed in your contact form page
  1. install
npm install react-google-recaptcha
  1. how it looks
import ReCAPTCHA from 'react-google-recaptcha';
import { useRef } from 'react';
@heridev
heridev / content.md
Last active December 7, 2024 14:42
Determine if AWS Cognito V6 Generation 2 does not refresh accessToken automatically as it was the case for v5(pre v6)

First of all you need to change the expiration for access Token and ID token

Within the Cognito User Pool configure that to be 5 minutes(300 seconds) and both values should match, this way you can make the test faster than waiting for the default 1 hour expiration.

  1. Open your AWS Cognito console.
  2. Go to your user pool and then App integration.
  3. Scroll down to App clients(probably your web client) and click edit

NOTE: Make the update for any App clients you see in your user pool, in my case it was for the app client and web client

image

git checkout master
git branch feature-one
git branch feature-two
@heridev
heridev / content.md
Last active March 20, 2024 21:39
How to create your own HTTP API client gem in Ruby
@heridev
heridev / content.md
Last active March 29, 2024 21:53
How to access request headers in a Rack middleware application? (Rails, Sinatra, etc)

In a Rack-based application, including frameworks built on top of Rack like Ruby on Rails and Sinatra, middleware plays a crucial role in processing HTTP requests and responses. When you're working within a Rack middleware, accessing request headers is straightforward because the request is represented as an environment hash (env) passed to the call method of your middleware.

Here's how to access request headers in different ways within a Rack middleware:

Using Rack::Request.new

app/middleware/user_token_authenticator_middleware.rb

class UserTokenAuthenticatorMiddleware
  def initialize(app)
@heridev
heridev / 999-circleci.yml
Last active October 27, 2022 19:30
Code for blog post - How to architect integration or End-to-end(E2E) or system tests for frontend Single Page Applications
# Jest and Cypress(e2e) tests configuration for CircleCi
version: 2.1
orbs:
cypress: cypress-io/cypress@1
jest: blimmer/[email protected]
executors:
with-cypress-node-14-17:
docker:
- image: cypress/base:14.17.0
jobs:
@heridev
heridev / amazon-bounces-management.md
Last active May 2, 2022 22:14
Elevated email bounce rates through your Amazon SES account

Elevated email bounce rates through your Amazon SES account

In this article, I'm going to be sharing how we got notified of our elevated email bounce rates, how we made a first big reduction by enabling the suppression list functionality on AWS SES, and then how we were able to identify bounced accounts and the commands and CLI tools you can use for managing your suppression list.

It is Friday, and all of a sudden you receive an Amazon support email saying that your account has been moved under review. 😱

We placed your SES account in the US xxx (City) Region under review. You can still use this account to send emails, but you should fully address the problems that led to your account being placed under review.

So, what are the steps that we followed in order to fix this problem?

@heridev
heridev / 0_unique_data.md
Last active March 9, 2022 16:01 — forked from DmitryTsepelev/0_unique_data.md
Active record duplicates, prevent duplicates, benchmark on duplicates with active record, single file ruby with rails active record benchmark, single file benchmarking active record duplicates
@heridev
heridev / content.md
Created October 13, 2021 00:29
Third party SAML Single Sign On (SSO) integration/implementation - Tech spec

Third party SAML Single Sign On (SSO) integration/implementation - Tech spec

  • Author: Heriberto Perez

Background

The implementation of SSO in order to connect with other services/providers/sites is a common requirement these days

For those cases when you have the need to integrate a third party service and embed some widgets in your site, and in order to make it in a secure way and based on dynamic data for the current authenticated, that is when the SSO integration comes handy for you.

Goals

This Tech spec will serve as a reference a SAML Single Sign On (SSO) integration.

@heridev
heridev / exceptions.md
Last active August 11, 2018 15:24
Refactoring the app into MVP : Fourth part - Exceptions

Let's start changing the repository to trigger an exception(typo in the orderby clause):

DatabaseBooksRepository.java

public class DatabaseBooksRepository implements BooksRepository {
  private final DatabaseHelper databaseHelper;
  public DatabaseBooksRepository(Content context) {
   databaseHelper = OpenHelperManager.getHelper(context, DatabaseHelper.class);
  }