Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View AugustoCalaca's full-sized avatar

Augusto Calaca AugustoCalaca

View GitHub Profile
@AugustoCalaca
AugustoCalaca / lodashGetToOptionalChaining.js
Created March 16, 2022 00:35
codemod to convert lodash get to use optional chaining
const lodashGetToOptionalChaining = (file, api) => {
const codeShift = api.jscodeshift;
const root = codeShift(file.source);
const importDeclaration = root.find(codeShift.ImportDeclaration, {
source: {
type: 'Literal',
value: 'lodash/get',
},
@AugustoCalaca
AugustoCalaca / graphiql-over-ws.html
Created January 14, 2022 18:28 — forked from enisdenjo/graphiql-over-ws.html
GraphiQL ❤️ graphql-ws
<!--
* Copyright (c) 2021 GraphQL Contributors
* All rights reserved.
*
* This code is licensed under the MIT license.
* Use it however you wish.
-->
<!DOCTYPE html>
<html>
<head>

AWS Fargate Docker Simple Deployment Setup with SSL termination

How to:

  • create a Docker-based AWS Fargate/ECS deployment
  • without the Docker containers having a public IP
  • with an Application Load Balancer as reverse proxy / SSL termination proxy sitting in front of the containers

For Fargate/ECS to be able to access your Docker images hosted on ECR (or somewhere else) you'll have to allow outbound internet access to the Fargate subnets. Here's how you do it.

@AugustoCalaca
AugustoCalaca / esbuild-relay.js
Created October 13, 2021 13:25 — forked from sciyoshi/esbuild-relay.js
Esbuild plugin for compiling relay queries
import { promises } from "fs";
import crypto from "crypto";
import path from "path";
import { print, parse } from "graphql";
const plugin = {
name: "relay",
setup: build => {
build.onLoad({ filter: /\.tsx$/, namespace: "" }, async args => {
let contents = await promises.readFile(args.path, "utf8");
@AugustoCalaca
AugustoCalaca / query.sql
Created September 10, 2021 00:22
How to find duplicate text values with postgres
select id, name from table t1
where (
select count(*) from table t2
where regexp_replace(unaccent(trim(t1.name)), '\W+', '', 'g') ilike regexp_replace(unaccent(trim(t2.name)), '\W+', '', 'g')
) > 1
order by name asc
@AugustoCalaca
AugustoCalaca / workflow.yml
Last active October 16, 2023 19:18
example of workflow ci/cd for monorepo with github actions
name: CI/CD Monorepo
env:
AWS_REGION: us-east-1 # N. Virginia
on:
push:
branches:
- main
paths-ignore:
name: Test, Build and Deploy
on:
pull_request:
types: [closed]
jobs:
build-test-release:
if: github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
@AugustoCalaca
AugustoCalaca / debugRelay.ts
Created April 12, 2021 14:54 — forked from sibelius/debugRelay.ts
debug relay utils
import prettyFormat from 'pretty-format';
const excludeKeys = ['__fragments', '__id', '__fragmentOwner'];
// strip __fragments, __id, __fragmentOwne
export const relayTransform = (key: string, value: string) => {
if (excludeKeys.includes(key)) {
return undefined;
}
@AugustoCalaca
AugustoCalaca / devTraining.md
Created April 5, 2021 01:05 — forked from sibelius/devTraining.md
How to train your dev team

you should review every pull request of your team

  • each pull request will make understand what everyone in your team is working on
  • it will ensure you keep consistency of file location, and code patterns
  • it will catch bugs/regression early on
  • it will teach the best way to solve the problem

you should ensure consistency of the code base

you should pair programming with all devs of your team

@AugustoCalaca
AugustoCalaca / MEMOIZE.md
Created April 5, 2021 00:42 — forked from mrousavy/MEMOIZE.md
Memoize!!! 💾 - a react (native) performance guide
In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and  
returning the cached result when the same
inputs occur again.                                         
                                                     — wikipedia