Skip to content

Instantly share code, notes, and snippets.

View AugustoCalaca's full-sized avatar

Augusto Calaca AugustoCalaca

View GitHub Profile
@sibelius
sibelius / useRelayPagination.tsx
Created November 28, 2019 14:30
back and forward pagination
import dot from 'dot-object';
import { stringify } from 'query-string';
import React, { useState } from 'react';
import { RelayRefetchProp } from 'react-relay';
import { RouteComponentProps, useHistory } from 'react-router-dom';
export type PaginationProps = {
handleRowsPerPageChange: (quantity: number) => void;
totalItems: number;
rowsPerPage: number;
@sibelius
sibelius / relay.config.js
Created November 17, 2019 00:58
Relay Config that works well with monorepo, you can spread your fragments in many packages
module.exports = {
schema: './data/schema.graphql',
language: 'typescript',
src: '../.',
include: [
'./web/src/**',
'./shared/src/**',
],
};
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
@renanmav
renanmav / environment.js
Created September 20, 2019 20:09
Setup RelayNetworkLogger with relay-runtime v6
import { Network } from 'relay-runtime'
import createRelayNetworkLogger from 'relay-runtime/lib/network/createRelayNetworkLogger'
import RelayNetworkLoggerTransaction from 'relay-runtime/lib/network/RelayNetworkLoggerTransaction'
import cacheHandler from './cacheHandler'
const RelayNetworkLogger = createRelayNetworkLogger(RelayNetworkLoggerTransaction)
const network = Network.create(
@tcodes0
tcodes0 / lazy git
Last active June 20, 2024 13:27
lazy git function with commilint style messages
#! /usr/bin/env bash
# LAZY GIT
# with commitlint automation. Does git add --all and builds commit message:
# lg foo bar -> chore(misc): foo bar
# lg chore bar -> chore(misc): bar
# lg chore app: fix stuff -> chore(app): fix stuff
lg() {
local args="$*"
local commitTypes=(build ci chore docs feat fix perf refactor revert style test)
@fakenickels
fakenickels / metro.config.js
Last active December 22, 2019 04:54 — forked from sibelius/metro.config.js
metro config to work with yarn workspaces
const path = require('path');
const getWorkspaces = require('get-yarn-workspaces');
const blacklist = require('metro-config/src/defaults/blacklist');
const workspaces = getWorkspaces(__dirname);
// Blacklists any react-native that doesn't come from packages/app
const blacklistRE = blacklist([ /(?<!packages\/app\/)node_modules\/react-native\/.*/g])
@sibelius
sibelius / Sample.tsx
Created February 27, 2019 15:47
useRelayPagination to be used with React Native Flatlist
const {
isFetchingEnd,
isFetchingTop,
onRefresh,
onEndReached,
} = useRelayPagination(relay, users);
const isRefreshing = isFetchingEnd || isFetchingTop;
<FlatList
@sibelius
sibelius / metro.config.js
Created December 30, 2018 11:28
Metro config to make react native play nice with monorepos
const path = require('path');
const getWorkspaces = require('get-yarn-workspaces');
const blacklist = require('metro-config/src/defaults/blacklist');
const workspaces = getWorkspaces(__dirname);
module.exports = {
projectRoot: path.resolve(__dirname, 'packages/app'),
@swyxio
swyxio / 1.md
Last active September 7, 2025 18:44
Learn In Public - 7 opinions for your tech career

2019 update: this essay has been updated on my personal site, together with a followup on how to get started

2020 update: I'm now writing a book with updated versions of all these essays and 35 other chapters!!!!

1. Learn in public

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos

@jonashaag
jonashaag / aws_fargate_docker_application_load_balancer_without_public_ip.md
Last active March 14, 2024 23:34
AWS Fargate Docker Application Load Balancer Howto (without public IP)

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.