Skip to content

Instantly share code, notes, and snippets.

View AugustoCalaca's full-sized avatar

Augusto Calaca AugustoCalaca

View GitHub Profile
@jgcmarins
jgcmarins / babel.config.js
Created March 3, 2021 19:57
Angora JavaScript build setup with Webpack and Babel (https://www.npmjs.com/package/@angoralabs/angora-js)
module.exports = {
presets: [
'@babel/preset-react',
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
@sciyoshi
sciyoshi / esbuild-relay.js
Created February 19, 2021 16:34
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");
@sibelius
sibelius / backendLearningPath.md
Created January 15, 2021 14:59
Backend Learning Path - Basics that you should learn
  • learn about basic database modelling, use excalidraw
  • learn how to connect to a database and performe queries
  • learn how to expose a CRUD API REST and/or GraphQL
  • learn how to document the API using Swagger, swagger-jsdoc is the best for it
  • learn how to test your API using Postman, and also automated using jest and supertest
  • learn how to consume other APIs using fetch

Also check Docker Learning Path and Lambda Learning Path

@sibelius
sibelius / testingConcept.md
Last active February 1, 2024 17:36
testing library concept and basic test

You first need to undestand the concept of frontend tests.

You should not test the implementation but the behavior

You test like the end user

For instance, imagine a login screen with email and password inputs and a submit button

The test should input the email and the password, then click in the submit button.

@sibelius
sibelius / dockerLearnPath.md
Last active October 31, 2023 00:09
Docker Learn Path - What do you need to know about Docker
  • learn why we need docker
  • learn how to define a Dockerfile
  • learn how to build a docker
  • learn how to list images
  • learn how to run docker with port forward
  • learn how to go inside docker to debug, running /bin/bash
  • learn docker compose
  • learn how to send a docker image to a reqistry (dockerhub or aws ecr)
  • learn how to deploy a docker to kubernetes, aws ecs or another platform
  • learn how to use docker volumes
@sibelius
sibelius / Dockerfile
Last active December 17, 2021 14:23
simple dockerfile using a single .js file generated by webpack
FROM node:12.20.1
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV GRAPHQL_PORT=5001
EXPOSE ${GRAPHQL_PORT}
COPY ./build/graphql.js /usr/src/app/
@sibelius
sibelius / awsLamdbaExperience.md
Last active October 31, 2023 00:09
AWS Lamdba Learning Path - What do you need to learn about aws lambdas?
  • learn how to bundle backend using webpack in a single bundle (check this https://gist.github.com/jgcmarins/2860f547f5d785dce24ca0eadbe3abdd)
  • learn how to automate lamdba deploys using serveless or aws cdk (github actions)
  • learn how to configure and automate api gateway
  • learn how to automate tests lambdas using jest
  • learn how to configure, automate and use RDS Proxy to fast database workflow in lamdbas (also cache database connections)
  • how the performance gain using RDS Proxy over normal database usage
  • learn about cold start and lambda statefull (https://www.swyx.io/stateful-serverless/)
  • expose a CRUD api in lamdba
  • put everything on open source (github)
  • write a blog post about each of the topics above
@sibelius
sibelius / devTraining.md
Created January 8, 2021 12:48
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

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
@emmanuelnk
emmanuelnk / koa-context.ts
Last active June 7, 2022 16:32
Simple Koa Context for testing in Typescript (Mocha-chai, Jest) etc
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
// Ripped from https://github.com/koajs/koa/blob/master/test/helpers/context.js
// Solution courtesy of user @fl0w. See: https://github.com/koajs/koa/issues/999#issuecomment-309270599
// I've disabled type checking in this file but you are free to add types if you wish
// if you want more comprehensive Koa Context object to test stuff like Cookies etc
// then use https://www.npmjs.com/package/@shopify/jest-koa-mocks (requires Jest)