Skip to content

Instantly share code, notes, and snippets.


Gabriel Cangussu gcangussu

  • Belo Horizonte, Brazil
View GitHub Profile
gcangussu / factories.ts
Last active Mar 24, 2021
Mock /loan/rfqs/ endpoint on frontend. You need to change two files.
View factories.ts
// packages/utils/tests/factories.ts
// import { createHash } from 'crypto';
import faker from 'faker';
* Seed the random sequence that generates the random values.
* @param sentence Any string to use as seed
export function seed(sentence: string) {
gcangussu / render_with_wb.js
Created Dec 10, 2020
Avoid blinking on first visit with service worker
View render_with_wb.js
* When we have a workbox we must be sure to just render the
* app when we assert that we are running the latest version.
* Otherwise the user can start interacting with the app and
* right after an update arrives and the page is reloaded.
if (wb != null) {
.then((serviceWorker) => {
/* When the service worker active is not controlling the
gcangussu / removeRequirePaths.js
Created Mar 2, 2020
Prevent Node.js require looking for node_modules in parent directories. Usefull for isolating your project against node_modules directories upward in the file hierarchy.
View removeRequirePaths.js
// Put this on the top of your entry file or use Node's `-r` cli option
const { Module } = require("module");
const originalResolveLookupPaths = Module._resolveLookupPaths;
Module._resolveLookupPaths = function(request, parent) {
const paths =, request, parent);
if (request.startsWith(".")) return paths;
gcangussu / jest-resolver.js
Last active Mar 25, 2021
Custom Jest resolver to preserve symlinks. Useful for usage with Bazel. Requires `resolve` npm package.
View jest-resolver.js
const resolve = require('resolve');
* @typedef {{
basedir: string;
browser?: boolean;
defaultResolver: (request: string, options: ResolverOptions) => string;
extensions?: readonly string[];
moduleDirectory?: readonly string[];
paths?: readonly string[];
gcangussu / tsconfig.json
Last active Sep 23, 2018
Typescript setup for back end
View tsconfig.json
"compilerOptions": {
/* Basic Options */
"target": "es2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es2018"], /* Specify library files to be included in the compilation. */
"resolveJsonModule": true,
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
gcangussu / babel.config.js
Created Sep 21, 2018
Babel config for front end
View babel.config.js
const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
module.exports = {
presets: [
targets: {
chrome: '65',
gcangussu / tsconfig.json
Created Sep 21, 2018
Typescript compiler setup for front end
View tsconfig.json
"compilerOptions": {
/* Basic Options */
"target": "es2018",
"module": "es2015",
"resolveJsonModule": false, // Don't use untill fixed:
"lib": ["dom", "esnext"],
"allowJs": false,
"jsx": "preserve",
"sourceMap": true,
gcangussu / .eslintignore
Last active Sep 23, 2018
Eslint front end setup
View .eslintignore
View webpack.config.js
const path = require('path');
const history = require('connect-history-api-fallback');
const convert = require('koa-connect');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');