Skip to content

Instantly share code, notes, and snippets.

View MatthewRDodds's full-sized avatar

Matthew Russell Dodds MatthewRDodds

View GitHub Profile
@MatthewRDodds
MatthewRDodds / a.md
Last active January 20, 2016 22:27
Rails 4 Omniauth Facebook and Linkedin Recipe (Clearance)

Prereqs:

Have a User model with these attributes:

  • uid:string
  • provider:string
  • first_name:string
  • last_name:string
  • email:string
@MatthewRDodds
MatthewRDodds / a.shell
Created January 18, 2016 22:47
Refresh Heroku Database (Rails 4)
heroku pg:reset DATABASE --confirm app_name
heroku run rake db:gis:setup
heroku run rake db:migrate
heroku run rake db:seed
@MatthewRDodds
MatthewRDodds / a.rb
Last active December 21, 2015 23:26
Rails Model generator attributes script for backbone
`rails g backbone:scaffold Model #{Model.columns_hash.map { |name, c| "#{name}:#{c.type}" }.join ' '}`
@MatthewRDodds
MatthewRDodds / a.md
Created November 16, 2015 14:31
flux architecture review + comparison to redux

Redux Architecture Research

Researching patterns and components composing a flux architecture, and how they can be integrated current development processes.

Flux Architecture Review

Flux is the application architecture that Facebook uses for building client-side web applications. It complements React's composable view components by utilizing a unidirectional data flow.

Hint: Flux is more of an architecture pattern for managing the flow of data throughout a react application, rather than a framework

@MatthewRDodds
MatthewRDodds / graph.rb
Created September 29, 2015 16:16
Ruby Graph Sample Data Generator
require 'json'
class NodeConnectionGenerator
attr_reader :node_count
attr_accessor :nodes, :edges
def initialize(node_count)
@node_count = node_count
@nodes = []
@edges = []
@MatthewRDodds
MatthewRDodds / gist:ecf3a2dcdfd12f5047f9
Last active September 28, 2015 16:38
Install IGraph
echo
echo "preparing for install"
echo
brew update
echo
echo "installing libraries with brew"
echo
@MatthewRDodds
MatthewRDodds / gist:8d27230df9b17de32fae
Created September 21, 2015 14:00
new rails project
rails new [NAME] --skip-turbolinks --skip-test-unit --database=postgresql
Sen. Rand Paul (KY)...as in the one who’s a libertarian. Drink every time he gets fired up and calls himself a “real conservative.”
Former Gov. Mike Huckabee (AR)...as in the former pastor who’s really down with G-O-D. Drink when he mentions his support for a Kentucky clerk who refused to issue same-sex marriage licenses.
Sen. Marco Rubio (FL)...as in the one with the hair. Who many think will end up with a VP name tag. Drink when he talks about immigration or his Cuban-American background.
Sen. Ted Cruz (TX)...as in the one who likes Tea Parties. Drink every time he mentions the words “defund” and “Planned Parenthood” in the same sentence.
Dr. Ben Carson...as in the one who separated conjoined twins. And the only one who’s pulling numbers like The Donald. Drink every time Carson mentions how his lack of political experience sets him apart.
@MatthewRDodds
MatthewRDodds / a.html
Created September 11, 2015 21:07
Uncaught Error: invalid version specified
<html>
<head>
<title>Your Website Title</title>
<!-- You can use open graph tags to customize link previews.
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
<meta property="og:url" content="http://www.your-domain.com/your-page.html" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Your Website Title" />
<meta property="og:description" content="Your description" />
<meta property="og:image" content="http://www.your-domain.com/path/image.jpg" />
SELECT *
FROM posts
INNER JOIN category_joins as filter_categories_join
ON filter_categories_join.categorizable_id = posts.id
AND filter_categories_join.categorizable_type = 'Post'
INNER JOIN categories as filter_categories
ON filter_categories.id = filter_categories_join.category_id
INNER JOIN category_joins as categories_join_1
ON categories_join_1.categorizable_id = posts.id
AND categories_join_1.categorizable_type = 'Post'