Skip to content

Instantly share code, notes, and snippets.

View stephen-puiszis's full-sized avatar

Stephen Puiszis stephen-puiszis

View GitHub Profile
@stephen-puiszis
stephen-puiszis / gist:5360155
Created April 11, 2013 02:22
Facebook API Demo
require 'open-uri'
require 'json'
your_access_token = "put your access token from the Graph API Explorer here"
url = "https://graph.facebook.com/me/home?fields=from,picture,link,source,name,description,type&access_token=#{your_access_token}"
result = JSON.parse(open(url).read)
posts = result["data"]
@stephen-puiszis
stephen-puiszis / gist:5453334
Created April 24, 2013 16:07
Seed file for skeleton apps (Shaq GIFs)
pictures = [
{ :url => "http://i.cdn.turner.com/dr/teg/coco/release/sites/default/files/0229_ShaqRoar.gif", :name => "Shaq", :caption => "Shaq is going to eat Conan" },
{ :url => "http://i.imgur.com/AvKuM6i.gif", :name => "Shaq being Shaq", :caption => "Awesome" },
{ :url => "http://instntrply.com/wp-content/uploads/2011/12/shaqtree.gif", :name => "Christmas Tree", :caption => "TNT" },
]
pictures.each do |pic|
p = Picture.new
p.name = pic[:name]
p.url = pic[:url]
@stephen-puiszis
stephen-puiszis / gist:5560863
Created May 11, 2013 18:15
Crunchbase Individuals
#----- Individuals------#
require 'open-uri'
require 'json'
base_url = "http://api.crunchbase.com/v/1/"
key = "atsvjzz7q9apzywd9ex3t67e"
api_key = "&api_key=#{key}"
people = "people.js?"
data = JSON.parse(open(base_url+people+api_key).read)
@stephen-puiszis
stephen-puiszis / gist:5589117
Created May 16, 2013 03:08
Seeds file for database
# --- Seeds the State Database ---- #
states = {
'ABA'=> 'American Bar Association',
'AL' => 'Alabama',
'AK' => 'Alaska',
'AZ' => 'Arizona',
'AR' => 'Arkansas',
'CA' => 'California',
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@stephen-puiszis
stephen-puiszis / gist:522ebdd15849bc8e0000
Created September 23, 2014 00:09
Read a Sitemap.xml file and save any links to a file in that same directory. Then CURL every link from that file to read headers. Best used to quickly verify your site map is returning 200s.
grep <sitemap file> --only-matching -E -e 'http(s?):\/\/[^ \"\(\)\<\>]*' >> links.txt
for i in `cat links.txt` ; do curl -I $i ; done (edited)
@stephen-puiszis
stephen-puiszis / analytics.js.coffee
Created October 18, 2014 18:23
Turbolinks / Google Analytics Integration using new analytics.js library. Uses Gon to pass Rails settings variables to the coffescript.
# google_analytics.js.coffee
class @GoogleAnalytics
@load: ->
window['GoogleAnalyticsObject'] = 'ga'
window['ga'] = window['ga'] || ->
(window['ga'].q = window['ga'].q || []).push arguments
window['ga'].l = 1 * new Date()
@stephen-puiszis
stephen-puiszis / rails-new
Last active August 29, 2015 14:09
New Rails App with Postgres, Skipping Test Unit and Bundle
rails new . --database=postgresql --skip-bundle -T
@stephen-puiszis
stephen-puiszis / missing_harvest_entries.rb
Created December 2, 2014 23:08
Find Your Missing Harvest Descriptions
require 'date'
require 'harvested'
class MissingHarvestEntries
attr_accessor :subdomain, :username, :password, :timesheet, :missing_entries, :start_date, :end_date
def initialize(start_date, end_date)
@subdomain = 'MY SUBDOMAIN'
@username = 'MY USERNAME'
@password = 'MY PASSWORD'
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end