Skip to content

Instantly share code, notes, and snippets.

Jesse Buchanan jbinto

Block or report user

Report or block jbinto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cypress_mocks.js
// option 1 to override fetch, using cypress built-in facilities (e.g. sinon)
cy
// sinon syntax ⬇️
.stub(win, 'fetch')
.withArgs('/graphql')
// The pseudocode-ish that this generates, kinda like this:
const realFetch = window.fetch
window.fetch = (arg1) => {
View elasticbeanstalk_deploy_iam_policy.md

I am deploying with this IAM using Codeship and Circle CI to Elastic Beanstalk. I had a lot of trouble with this config. I talked to the aws support for about 6 hours until this worked properly, so, I guess it is worth to share.

UPDATE: In the end, I have to use the AWSElasticBeanstalkFullAccess policy. My custom policy keep breaking every week with some new added permission or some EB internal change. Anyway, the IAM I was using is below.

This works for me with CircleCI and EB Cli.

{
    "Version": "2012-10-17",
    "Statement": [
        {
@jbinto
jbinto / test.js
Created May 10, 2017 — forked from jbaxleyiii/test.js
react-apollo testing
View test.js
import { Component } from "react";
import { print } from "graphql-tag/printer";
import { graphql } from "react-apollo";
import { MockedProvider } from "react-apollo/test-utils";
import { addTypenameToDocument } from "apollo-client/queries/queryTransform";
import { mount } from "enzyme";
import { withSavedPayments, SAVED_ACCTS_QUERY } from "../";
@jbinto
jbinto / checkit-reference.md
Created Mar 15, 2017 — forked from joepie91/checkit-reference.md
Quick reference for `checkit` validators
View checkit-reference.md

Presence

  • exists - The field must exist, and not be undefined.
  • required - The field must exist, and not be undefined, null or an empty string.
  • empty - The field must be some kind of "empty". Things that are considered "empty" are as follows:
    • "" (empty string)
    • [] (empty array)
    • {} (empty object)
    • Other falsey values
@jbinto
jbinto / foo.sh
Created Feb 7, 2017
Extract info from npm packages
View foo.sh
cat /tmp/packages.txt | while read PACKAGE
do
yarn info $PACKAGE --json |
head -n1 |
jq --raw-output '"\"\(.data.name)\", \"\(.data.version)\", \"\(.data.homepage)\", \"\(.data.license)\", \"\(.data.description)\""' |
tee -a /tmp/output3.txt
done
@jbinto
jbinto / deploy_with_ebcli3_on_circleci.md
Created Jan 25, 2017 — forked from RobertoSchneiders/deploy_with_ebcli3_on_circleci.md
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)
View deploy_with_ebcli3_on_circleci.md

This is how I configured the deploy of my rails apps to AWS Elastic Beanstalk through CircleCI.

Configure Environments Variables

On Project Settings > Environment Variables add this keys:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
    The aws user must have the right permissions. This can be hard, maybe, this can help you.

Create a bash script to create the eb config file

@jbinto
jbinto / Foo.js
Created Dec 20, 2016
react-apollo stale variables when mixing pollInterval and skip
View Foo.js
import React from 'react';
import gql from 'graphql-tag'
import { graphql } from 'react-apollo'
export const QUERY = gql`
query($fooID: Int!) { foo(id: $fooID) { id } }
`
const withFoo = graphql(QUERY, {
skip: ownProps => ownProps.active !== true,
@jbinto
jbinto / circle.yml
Created Dec 13, 2016 — forked from benjie/circle.yml
Getting PLv8 to run on Postgresql 9.5 on CircleCI (Ubuntu 14.04)
View circle.yml
dependencies:
pre:
- sudo apt-get update
- sudo pip install pgxnclient
- sudo apt-get install libpq-dev libv8-dev postgresql-server-dev-9.5
- sudo pgxn install 'plv8=1.4.4'
# Just to be 100% certian you are using 9.5, and save a bit of memory.
- sudo service postgresql stop 9.4
- sudo service postgresql restart 9.5
@jbinto
jbinto / segfault_libgraphqlparser.md
Created Jul 27, 2016
segfault libgraphqlparser
View segfault_libgraphqlparser.md

https://github.com/Shopify/graphql-parser

Inside visit_variable_definition_name, pry breakpoint, ls node:

GraphQL::Parser::VariableDefinition#methods: default_value  type  variable

node.type or node.default_value will segfault the parser.

View gist:9beacd50a0044f756efe
> reactjs-boilerplate@2.4.0 pretest /Users/jbinto/dev/react-boilerplate
> npm run lint
> reactjs-boilerplate@2.4.0 lint /Users/jbinto/dev/react-boilerplate
> npm run lint:js & npm run lint:css
> reactjs-boilerplate@2.4.0 lint:css /Users/jbinto/dev/react-boilerplate
You can’t perform that action at this time.