Skip to content

Instantly share code, notes, and snippets.

View etc-tiago's full-sized avatar

Tiago Souza etc-tiago

View GitHub Profile
@etc-tiago
etc-tiago / reader.env.json.ts
Created June 9, 2020 19:42
Zero-dependency module that loads environment variables from a .env.json file into process.env.
import { readFileSync } from 'fs';
import path from 'path';
type Config = {
envPath: string;
encoding: BufferEncoding;
debug: boolean;
};
export default ({ envPath = path.resolve(process.cwd(), '.env.json'), encoding = 'utf8', debug = false }: Config) => {
@etc-tiago
etc-tiago / Files changed since last tag
Created May 13, 2020 14:22 — forked from arnold-almeida/Files changed since last tag
GIT: Files changed since last tag
#!/bin/bash
unset GIT_DIR
cd /path/to/project
# Get our info....
LATEST_TAG=$(git describe --tags --abbrev=0)
CURRENT_REVISION=$(git describe)
NUMBER_FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG | wc -l)
#FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG)
@etc-tiago
etc-tiago / README.md
Created May 13, 2020 14:21 — forked from joyrexus/README.md
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
// import
import { Dispatch } from 'redux';
import { connect } from 'react-redux';
// On Export
export default connect<IState, IAction>(
(state: any) => ({
// code
}),
/*
# file: Auth.tsx
name query: <File>Query|Mutation
*/
/* Query */
const queryIsAvaliable = graphql`
query AuthQuery($slug: String!) {
isRegistered(slug: $slug)

Use React Relay

Document in pt-br to explanation the sequencies of commands for build graphql client with relay and CRA.

Instalação do relay

react-relay - O pacote que permite usar relay no projeto react.

relay-compiler - Pacote de desenvolvimento que permite compilar o código graphql estatico.

@etc-tiago
etc-tiago / lambda-dynamodb-backup.js
Created April 1, 2020 23:55
Create dynamodb backup with lambda
const AWS = require("aws-sdk");
AWS.config.update({
region: process.env.AWS_REGION || 'sa-east-1'
});
const DynamoDB = new AWS.DynamoDB();
const getListTables = () => {
return new Promise((resolve, reject) => {
try {
DynamoDB.listTables((err, data) => {