Skip to content

Instantly share code, notes, and snippets.

View johnnygoodman's full-sized avatar

Johnny Goodman johnnygoodman

View GitHub Profile
@johnnygoodman
johnnygoodman / gist:5555000
Created May 10, 2013 15:07
Framebase call
<div id="video">
<video type='framebase' data-video='f4ad2fdf-d272-481e-9c9a-904fcf182404' width="500" height="400"></video>
</div>
require 'rubygems'
require 'google_calendar'
require 'awesome_print'
require 'date'
require 'time'
cal = Google::Calendar.new(:username => 'my@gmail.com',
:password => 'awesome_password_of_lore',
:app_name => 'CDS Calendar')
1.9.3p194 :009 > message.api.request(:get, message.body_parts.resource_url)
=> [{"type"=>"text/plain", "charset"=>"utf-8", "content"=>"X applied to the Y position posted on Indeed. You will find their information below and resume attached (if one was provided).\r\n\r\nhttps://employers.indeed.com/m#candidates/view?id=Z\r\n\r\nName: X\r\nEmail:Y\r\nNote: the attached resume has not been scanned for viruses, be careful when opening attachments.", "body_section"=>"1.1"}, {"type"=>"text/html", "charset"=>"utf-8", "content"=>"<!doctype html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"></head><body style=\"line-height:16px;font-family:Arial,sans-serif\"><div style=\"width:500px;margin:0 0 10px 0;font-size:12px;padding-left:10px\"><div><img src=\"https://ads.indeed.com/images/email/indeed-logo-small.png\"/></div><div style=\"margin:10px;\"><div style=\"color:#666666\">You've received a new application for the job:</div><div style=\"margin-top:3px;font-weight:bold;\">X - Houston,
@johnnygoodman
johnnygoodman / gist:3822774
Created October 2, 2012 19:36
Shopify Product Images
product.images << ShopifyAPI::Image.new({:src => "http://c0009431.cdn.cloudfiles.rackspacecloud.com/pad-a-cheek-mask-straps-pair-top.jpg"})
product.save
@johnnygoodman
johnnygoodman / gist:3426583
Created August 22, 2012 15:07
Basic DataMapper Usage
require 'data_mapper'
DataMapper.setup(:default, ENV['SHARED_DATABASE_URL'] || "sqlite3://#{Dir.pwd}/development.db")
class Text
include DataMapper::Resource
property :id, Serial
property :email, String
property :full_text, String
property :phone, String
# Resource called by the Tropo WebAPI URL setting
post '/index.json' do
# Fetches the HTTP Body (the session) of the POST and parse it into a native Ruby Hash object
v = Tropo::Generator.parse request.env["rack.input"].read
# Fetching certain variables from the resulting Ruby Hash of the session details
# into Sinatra/HTTP sessions; this can then be used in the subsequent calls to the
# Sinatra application
session[:from] = v[:session][:from]
in a rails app...
1. Paste this into the bottom of your gemfile
source "http://gems.github.com"
gem 'contextio', :git => 'git://github.com/contextio/Ruby-ContextIO.git', :branch => 'dev_2.0'
2. Bundle install per usual
1. CLI:
Admins-MacBook-Pro:gemtest johnnygoodman$ rvm gemset create contextio
'contextio' gemset created (/usr/local/rvm/gems/ruby-1.9.3-p194@contextio).
Admins-MacBook-Pro:gemtest johnnygoodman$ rvm gemset use contextio
Using ruby-1.9.3-p194 with gemset contextio
Admins-MacBook-Pro:gemtest johnnygoodman$ touch Gemfile
Admins-MacBook-Pro:gemtest johnnygoodman$ touch app.rb
Admins-MacBook-Pro:gemtest johnnygoodman$ mate .
Admins-MacBook-Pro:gemtest johnnygoodman$ bundle install
connection = ContextIO::Connection.new(key, secret)
puts connection.methods
all_messages
all_files
addresses
contact_search
contact_files
contact_messages
require 'oauth'
require 'net/http'
module ContextIO
VERSION = "2.0"
class ContextIO::Connection
def initialize(key='', secret='', server='https://api.context.io')
@consumer = OAuth::Consumer.new(key, secret, {:site => server, :sheme => :header})
@token = OAuth::AccessToken.new @consumer