Skip to content

Instantly share code, notes, and snippets.

View gabrieljoelc's full-sized avatar

Gabriel Chaney gabrieljoelc

View GitHub Profile
@alfianlosari
alfianlosari / react-apollo-github-pagination-query.js
Created June 23, 2018 04:08
React Apollo Github Pagination Trending Repositories Query
import gql from "graphql-tag";
export const trendingRepositoriesGQLQuery = gql`
query search($query: String!, $cursor: String) {
search(first: 15, query: $query, type: REPOSITORY, after: $cursor) {
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
@gabrieljoelc
gabrieljoelc / .0_windows_setup.md
Last active March 5, 2021 20:14
Gabe's Windows Setup

https://www.howtogeek.com/265900/everything-you-can-do-with-windows-10s-new-bash-shell/

  1. Install "Windows Subsystem on Linux" for
  2. Install Debian instead of Ubuntu because it doesn't include GUI which I'm not going to use
  3. Debian WSL requires Windows build 1083 so you'll need to ensure this is upgraded before it'll work
  4. https://www.howtogeek.com/258518/how-to-use-zsh-or-another-shell-in-windows-10/
  5. Install hyper.is Hyper was pretty slow even in typing responsiveness. I switched to just using the out-of-the-box Debian WSL terminal and tmux for tabs (see tmux section below)
  6. Run the following:
sudo apt update && sudo apt upgrade
sudo apt-get install zsh
// @flow
import { ApolloClient } from 'apollo-client';
import { ApolloLink } from 'apollo-link';
import { HttpLink } from 'apollo-link-http';
import { RetryLink } from 'apollo-link-retry';
import { AuthLink } from './link-auth';
import cache from './cache';
@brikis98
brikis98 / main.tf
Last active March 14, 2023 23:43
A hacky way to create a dynamic list of maps in Terraform
# The goal: create a list of maps of subnet mappings so we don't have to statically hard-code them in aws_lb
# https://www.terraform.io/docs/providers/aws/r/lb.html#subnet_mapping
locals {
# These represent dynamic data we fetch from somewhere, such as subnet IDs and EIPs from a VPC module
subnet_ids = ["subnet-1", "subnet-2", "subnet-3"]
eips = ["eip-1", "eip-2", "eip-3"]
}
# Here's the hack! The null_resource has a map called triggers that we can set to arbitrary values.
# We can also use count to create a list of null_resources. By accessing the triggers map inside of
@SimonLuckenuik
SimonLuckenuik / HttpRequests.cs
Last active December 29, 2020 16:38
Concept example: Hosting an AspNetCore WebAPI inside an Azure Functions
using System.Configuration;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
@damien-roche
damien-roche / _google-analytics.slim
Last active March 31, 2021 20:28
Slim Template Google Analytics (2018)
script{ async src="https://www.googletagmanager.com/gtag/js?id=YOURIDHERE" }
javascript:
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'YOURIDHERE');
@agrcrobles
agrcrobles / 1_initial_migration.js
Created January 29, 2018 16:28
Deploy voting contract
var Migrations = artifacts.require('./Migrations.sol');
module.exports = function(deployer) {
deployer.deploy(Migrations, { gas: 4612388 });
};
@gabrieljoelc
gabrieljoelc / .gitignore_global
Last active September 28, 2022 20:13
Gabe's Mac Setup Checklist - since I can't dockerize my host :(
# add to home directory
# git config --global core.excludesfile ~/.gitignore_global
# ignore vim swap files
*.swp
@gabrieljoelc
gabrieljoelc / 0_steps.md
Last active May 27, 2019 20:11
Heroku Docker Rails 5.1.3, Ruby 2.4.2 (I need to add a Heroku template to https://github.com/nickjj/orats)

Steps to deploy Dockerized Rails app to Heroku

Prerequisites

  1. Install Docker
  2. Install Ruby
  3. gem install orats (see https://github.com/nickjj/orats)
  4. Install Heroku Toolbelt

Steps

@stubailo
stubailo / fetch-graphql.js
Created September 5, 2017 08:15
Call a GraphQL API with fetch
require('isomorphic-fetch');
fetch('https://1jzxrj179.lp.gql.zone/graphql', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: '{ posts { title } }' }),
})
.then(res => res.json())
.then(res => console.log(res.data));