Skip to content

Instantly share code, notes, and snippets.

View jean-leonco's full-sized avatar

Jean Leonço jean-leonco

View GitHub Profile
@astuyve
astuyve / deny_snippet.json
Created January 17, 2024 15:00
Deny cloudwatch permissions from Lambda to save money
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
@lambdaxyzt
lambdaxyzt / image.jsx
Last active September 18, 2024 19:34
Remix Image Component ( use cache 'cacashe library' , stream base , sharp library )
// resource route component
import React from "react";
import { PassThrough } from "node:stream"
import fs from "node:fs"
import {createReadableStreamFromReadable} from "@remix-run/node"
import { defaultQuality,widths,mainImageReadStream,generatedImageReadstream, isThereImage,BadImageResponse } from "../../util/image.server"
export const loader = async ({ request }) => {
const url = new URL(request.url);
const src = url.searchParams.get("src");
@mrousavy
mrousavy / MEMOIZE.md
Last active September 26, 2024 13:19
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
@sibelius
sibelius / entria.md
Last active April 22, 2021 01:05
Things that you gonna learn at Entria

Most job post are about requirements that you should already know.

We think that you should learn a lot when working for a company.

So here is a list of many things that you are going to learn while working for us (and many more):

  • how to use git to work in a team
  • how to contribute to open source projects
  • how to manage .env files (configurations)
  • local vs staging vs production environments
@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.

@emersonlaurentino
emersonlaurentino / App.tsx
Created October 9, 2020 15:05
Lazy Scripts
import React, { FC, lazy, Suspense, useEffect, useState } from 'react'
const preloadComponent = () => import('./Component')
const Component = lazy(preloadDrawer)
const App: FC = () => {
useEffect(() => {
const handler = window.requestIdleCallback(preloadComponent)
@riggaroo
riggaroo / create_release_branch.yml
Last active October 31, 2024 21:45
Github Action workflow for creating release branch, updating versionName and versionCode, copying strings.xml to another repo, submitting PRs as per GitFlow.
name: Create Release Branch
on:
workflow_dispatch:
inputs:
versionName:
description: 'Name of version (ie 5.5.0)'
required: true
versionCode:
description: 'Version number (50500)'
required: true
@AugustoCalaca
AugustoCalaca / UserAddedSubscription.ts
Created June 13, 2020 19:26
A graphql subscription using the lib graphql-relay-subscription
import { subscriptionWithClientId } from 'graphql-relay-subscription';
import UserType from '../UserType';
import * as UserLoader from '../UserLoader';
import pubSub, { EVENTS } from '../../../channels/pubSub';
const UserAddedSubscription = subscriptionWithClientId({
name: 'UserAdded',
inputFields: {},
subscribe: () => pubSub.asyncIterator(EVENTS.USER.ADDED),