Skip to content

Instantly share code, notes, and snippets.

View cbmeeks's full-sized avatar
🏠
Working from home

cbmeeks cbmeeks

🏠
Working from home
View GitHub Profile
# how to save a record
# console...
key = "your key"
secret = "your secret"
# Chattanooga lat/lon = 35.0456297 / -85.3096801
client = Simplegeo.new( key, secret, "yourlayer" )
records = Simplegeo::Records.new( client )
<% title '<script language="javascript">alert("See, this works");</script>' %>
class ThirdpartyController < ApplicationController
before_filter :authenticate_user!
before_filter :get_consumer_info, :except => [ :index ]
def index
session[:request_token] = nil
end
def tripit
gem 'oauth'
class ThirdpartyController < ApplicationController
before_filter :authenticate_user!
before_filter :get_consumer_info, :except => [ :index ]
def index
session[:request_token] = nil
end
def tripit
gem 'oauth'
@cbmeeks
cbmeeks / gist:648291
Created October 27, 2010 02:30
This is how people are...at least in my experiences.
key = [92, 28, 3, 18, 62-8, 49-2-10, 74-8, 922, 87-9, 102, 67, 17, 17.99, 105, 129, 147, 189, 202, 88]
msg = 'D6U17E2TPCZ6C8D2DND8C8C02335QF8OD1AS4A3947BDA3DB8VFAOG43B3ED8R69ER235L6BE72JLA9'.downcase
msg += 'DJGI948NXTPTEMWIOMGNNZTP'.downcase
msg += 'pe85$%99e0zfj'.upcase.downcase
msg += 'Q&,;k.4qD_L/fZ2P0zyP)??@~=$YL_uTk6<t>tr(%US4)v1>\jfk5zPrF|5\Rnf'
msg += 'LEm5n18AplaOGJxUS6F8vlF7SWgRuH23KlPObtlJaqeipkYYrtPVliafI8NfCJk'.chomp
decode = ''
@cbmeeks
cbmeeks / gist:649915
Created October 27, 2010 20:35
TripIt OAuth Example for http://flocktravel.com
class ThirdpartyController < ApplicationController
before_filter :authenticate_user!
before_filter :get_consumer_info, :except => [ :index ]
def index
session[:request_token] = nil
@tripit = current_user.authorizations.where(:provider => "tripit")
end
def tripit
if k == "ActivityObject"
if @tripit_trip[k].is_a?(Hash)
@tripit_trip[k]["ObjectType"] = "ActivityObject"
tmp[ @tripit_trip[k]["StartDateTime"]["date"] ] = [] if tmp[ @tripit_trip[k]["StartDateTime"]["date"] ].nil?
tmp[ @tripit_trip[k]["StartDateTime"]["date"] ] << @tripit_trip[k]
elsif @tripit_trip[k].is_a?(Array)
@tripit_trip[k].sort_by { |h| h["StartDateTime"]["date"] }.each do |o|
o["ObjectType"] = "ActivityObject"
tmp[ o["StartDateTime"]["date"] ] = [] if tmp[ o["StartDateTime"]["date"] ].nil?
tmp[ o["StartDateTime"]["date"] ] << o
class LikesController < ApplicationController
before_filter :get_ids
respond_to :json
def videolink
results = {}
# check to see if the user has liked this videolink before
class LikesController < ApplicationController
before_filter :get_ids
respond_to :json, :js
def videolink
results = {}
# check to see if the user has liked this videolink before
def likes_the(obj)
like = Like.find_or_initialize_by_likeable_type_and_likeable_id_and_user_id(obj.class.name, obj.id, self.id)
like.amount = 1
like.save
end