Skip to content

Instantly share code, notes, and snippets.

View danielfttorres's full-sized avatar

Daniel Torres danielfttorres

  • Sao Paulo, Brazil
View GitHub Profile
@dabit3
dabit3 / schema.graphql
Created November 20, 2019 17:13
17 Access Patterns with GraphQL and AWS Amplify
type Order @model
@key(name: "byCustomerByStatusByDate", fields: ["customerID", "status", "date"])
@key(name: "byCustomerByDate", fields: ["customerID", "date"])
@key(name: "byRepresentativebyDate", fields: ["accountRepresentativeID", "date"])
@key(name: "byProduct", fields: ["productID", "id"])
{
id: ID!
customerID: ID!
accountRepresentativeID: ID!
productID: ID!
@jbjonesjr
jbjonesjr / getting-going-best-practices.md
Created May 2, 2018 19:57
Getting Going and Best Practices Guide

GitHub Onboarding and Introduction

A guide for getting started and best practices for teams new to, or improving their interactions with, GitHub

image GitHub's features and capabilities

This document is meant to help new teams to GitHub familiarize themselves with the features and platform, as well as start to explore some of the best practices. While not a complete exploration, it's meant as a introduction to the key tenets of using GitHub for your business. For teams and organizations that desire more one on one support, GitHub Professional Services has many different options available to customize tools, training, and process to best meet your needs. The GitHub offerings listed in the diagram above are just a sampling of the various capabilities and we'd love to create a customized offering to meet your specific organizational needs.

Overview and Intr

// Based on https://github.com/facebook/relay/blob/master/packages/react-relay/modern/ReactRelayQueryRenderer.js
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
@nodkz
nodkz / LookupQueryRenderer.js
Created December 27, 2017 08:21
Relay.Modern query renderers
/* @flow */
/* eslint-disable no-use-before-define, react/no-unused-prop-types */
import * as React from 'react';
import areEqual from 'fbjs/lib/areEqual';
// forked from https://github.com/robrichard/relay-query-lookup-renderer
// import type { CacheConfig, Disposable } from 'RelayCombinedEnvironmentTypes';
// import type { RelayEnvironmentInterface as ClassicEnvironment } from 'RelayEnvironment';
@Atinux
Atinux / async-foreach.js
Last active October 10, 2023 03:04
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@alfonsomunozpomer
alfonsomunozpomer / Fetch.test.js
Created September 28, 2017 12:51
How to test a React component that sets its state in componentDidMount with fetch, and how to mock it, in Jest
// https://github.com/alfonsomunozpomer/react-fetch-mock
import React from 'react'
import fetchMock from 'fetch-mock'
import Enzyme from 'enzyme'
import {shallow, mount, render} from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
Enzyme.configure({ adapter: new Adapter() })
@troyfontaine
troyfontaine / 1-setup.md
Last active May 9, 2024 15:16
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

AD-XX: <TOPIC - short, concise summary>

  • Date: <DATE - when the decision was made>
  • Driver: <DRIVER - list a single person driving consenus and decision making>
  • Stakeholders: <STAKEHOLDERS - list all relevant stakeholders affected by this decision>
  • Status: [PROPOSED | DECIDED | SUPERSEDED]
  • Categories: <CATEGORIES - use a simple grouping to help organize the set of decisions (e.g. backend, payment, user management, ...)>
  • Outcome: <OUTCOME - once decided, provide a short summary of the decision outcome here>

Context

@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 15, 2024 09:41
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@ronnyhartenstein
ronnyhartenstein / index.ios.js
Last active July 17, 2023 10:14
React Navigation: Parallel Navigators in React Native in a nutshell
import React from 'react'
import { AppRegistry } from 'react-native'
import setup from './setup'
AppRegistry.registerComponent('ReactNavigationTest', setup)