Skip to content

Instantly share code, notes, and snippets.

View dob's full-sized avatar

Doug Petkanics dob

View GitHub Profile
# If you post to a Ruby on Rails REST API endpoint, then you'll get an
# InvalidAuthenticityToken exception unless you set a different
# content type in the request headers, since any post from a form must
# contain an authenticity token.
#
# This example shows you how to post to a rails endpoint.
require 'json'

Keybase proof

I hereby claim:

  • I am dob on github.
  • I am dob (https://keybase.io/dob) on keybase.
  • I have a public key ASCFd8bnC0YRkStJkCdhdwNCEyQX3czehuIfLNtC7g_hsAo

To claim this, I am signing this object:

@dob
dob / homebrew_openssl_fail.output
Last active December 22, 2015 17:59
Error installing openssl via homebrew. Looks like a certificate error
mutumbo:~ dob$ brew doctor
Your system is ready to brew.
mutumbo:~ dob$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew
HEAD: 3003a4776cc5d9e1ee3d7d404f31e12bb1c1986f
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit ivybridge
OS X: 10.8.4-x86_64
@dob
dob / offer_response.json
Created September 14, 2011 22:45
Hyperpublic Advert Example
{
"payout":{
"value":0.25,
"type":"CPC",
"description":"default CPC payout"
},
"type":"deal",
"status":"active",
"image_url":"http://s3.amazonaws.com/prestigedevelopment/beta/offer_photos/4e5fa0336897a70001000503.jpg?1314889780",
"place":{
@dob
dob / gist:1218021
Created September 14, 2011 22:40
Hyperpublic Advert Example
{
"payout":{
"value":0.0,
"type":"CPC",
"description":"default CPC payout"
},
"type":"deal",
"status":"active",
"image_url":"http://s3.amazonaws.com/prestigedevelopment/beta/advert_photos/4e5fa0336897a70001000503.jpg?1314889780",
"place":{
{
"payout":{
"value":0.0,
"type":"CPC",
"description":"default CPC payout"
},
"type":"deal",
"status":"active",
"image_url":"http://s3.amazonaws.com/prestigedevelopment/beta/advert_photos/4e5fa0336897a70001000503.jpg?1314889780",
"place":{
@dob
dob / gist:1217987
Created September 14, 2011 22:25
Hyperpublic Place Response
{
"display_name":"Bayard's Ale House",
"perma_link":"http://hyperpublic.com/places/4dd5390de800dd013a000001/profile",
"phone_number":"+1 212 989 0313",
"tags":[
"Food",
"Brewery",
"Nightlife spots",
"Pubs",
"Bars & pubs",
{
"perma_link":"http://hyperpublic.com/places/4dd5390de800dd013a000001/profile",
"phone_number":"+1 212 989 0313",
"tags":[
"Food",
"Brewery",
"Nightlife spots",
"Pubs",
"Bars & pubs",
"Bars",
{
"perma_link":"http://hyperpublic.com/places/4dd5390de800dd013a000001/profile",
"phone_number":"+1 212 989 0313",
"tags":[
"Food",
"Brewery",
"Nightlife spots",
"Pubs",
"Bars & pubs",
"Bars",
@dob
dob / gist:1001063
Created May 31, 2011 19:01
Migrate to MongoDB sample migration method for places
class CopyPlaceJob
@queue = :general
def self.perform(id)
old_place = ::Place.find(id)
mongo_user = MongoHP::User.first(:conditions => {:old_id => old_place.user_id})
if mongo_user
place = mongo_user.hp_objects.create(:old_id => old_place.id,
:object_type => "Place",
:display_name => old_place.name,