Skip to content

Instantly share code, notes, and snippets.

View jbinto's full-sized avatar

Jesse Buchanan jbinto

View GitHub Profile
@jbinto
jbinto / gist:5421013
Created April 19, 2013 15:13
Procs vs Lambdas
# You can return from a lambda, and it will behave as expected.
write_two_words = lambda { |x, y| return "#{x} #{y}" }
puts write_two_words.call("hi", "there") # => hi there
def foo
# If you *explicitly* return from a Proc, you will actually return from the caller.
# Note that if you omit the "return" keyword, it behaves just like a lambda.
write_two_words = Proc.new { |x, y| return "#{x} #{y}" }
puts write_two_words.call("hi", "there")
@jbinto
jbinto / heroku.log
Created May 1, 2013 13:15
Heroku H12 request timeouts, PG::Error SSL SYSCALL error: EOF detected
2013-05-01T00:56:21.278781+00:00 app[web.1]: Started GET "/register" for 204.93.223.151 at 2013-04-30 20:56:21 -0400
2013-05-01T00:56:21.300491+00:00 app[web.1]: Rendered users/new.haml within layouts/application (7.6ms)
2013-05-01T00:56:21.300491+00:00 app[web.1]: Rendered shared/_form_errors.haml (0.1ms)
2013-05-01T00:56:21.300491+00:00 app[web.1]: Rendered layouts/shared/_messages.haml (0.1ms)
2013-05-01T00:56:21.300491+00:00 app[web.1]: Processing by UsersController#new as */*
2013-05-01T00:56:21.300491+00:00 app[web.1]: Rendered layouts/shared/_nav.haml (0.9ms)
2013-05-01T00:56:21.300491+00:00 app[web.1]: Rendered layouts/shared/_carousel.haml (0.4ms)
2013-05-01T00:56:21.300491+00:00 app[web.1]: Completed 200 OK in 12ms (Views: 12.1ms | ActiveRecord: 0.0ms)
2013-05-01T00:56:21.307102+00:00 heroku[router]: at=info method=HEAD path=/register host=www.puckpicks.ca fwd="204.93.223.151" dyno=web.1 connect=11ms service=33ms status=200 bytes=0
2013-05-01T00:57:51.101327+00:00 app[web.1]: Started GET "
@jbinto
jbinto / istanbul-report.diff
Created January 9, 2016 01:59
Diff: istanbul initial report vs re-run report
--- coverage/lcov.info 2016-01-08 20:51:59.000000000 -0500
+++ coverage/rerun/lcov.info 2016-01-08 20:44:13.000000000 -0500
@@ -1,26 +1,29 @@
TN:
-SF:src/constants.js
+SF:/Users/jbinto/dev/thirtyone-server/src/constants.js
FNF:0
FNH:0
-DA:1,1
-LF:1
@jbinto
jbinto / getTitle.js
Created January 13, 2016 07:04
Get title of remote (HTML) URL via jQuery
const getTitle = (url, callback) => {
$.get(`https://crossorigin.me/${url}`, (data) => {
const html = $.parseHTML(data);
const bogus = $('<bogus>').append(html);
const title = bogus.find('title').text();
callback(title);
});
};
var urls = [
@jbinto
jbinto / gist:9663989
Created March 20, 2014 13:43
thinkster.io chapter 4 fixes - Firebase not installed, JS files not included

While walking through Thinkster.io's AngularJS tutorial chapter 4 (Three-way data binding with a real-time server), I encountered some problems.

The tutorial advises us to:

  • run bower install angularfire --save
  • add firebase to the list of required modules
  • add a constant FIREBASE_URL to our app

After implementing the posts functionality, I tried it in the browser and got the following error (in Chrome console):

@jbinto
jbinto / segfault_libgraphqlparser.md
Created July 27, 2016 18:15
segfault libgraphqlparser

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.

> 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
@jbinto
jbinto / circle.yml
Created December 13, 2016 01:25 — forked from benjie/circle.yml
Getting PLv8 to run on Postgresql 9.5 on CircleCI (Ubuntu 14.04)
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 / Foo.js
Created December 20, 2016 21:19
react-apollo stale variables when mixing pollInterval and skip
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 / deploy_with_ebcli3_on_circleci.md
Created January 25, 2017 15:03 — forked from RobertoSchneiders/deploy_with_ebcli3_on_circleci.md
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)

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