This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#gotta be insane to do this, and american and 35 or older | |
if self.sane || !self.american || self.age < 35 | |
exit(1) | |
end | |
#assumes all affairs will become public by the time the election is over | |
affair-factor = (all_affairs - repented_affairs) * -1 | |
#if your religion isn't that of our founding fathers- you have problems. | |
if self.religion == public.perceived_founding_father_religion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set somevars, "foobar" | |
namespace :deploy do | |
task :default do | |
update | |
someother_task | |
reindex_solr | |
end | |
task :reindex_solr do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qa: | |
solr: | |
hostname: localhost | |
port: 8982 | |
log_level: INFO | |
master_solr: | |
hostname: masterserver.mydomain.com | |
port: 8982 | |
log_level: INFO | |
auto_commit_after_request: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function postToLinkedIn(comment) { | |
IN.API.Raw("people/~/current-status") | |
.method("PUT") | |
.body(JSON.stringify(comment)) | |
.result(handleLIResults) | |
.error(handleLIErrors); | |
}; | |
function handleLIErrors(error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postcomment = "blah blah must be < 140. Oh and # are probably a good idea to use in here". | |
liscript = liscript +%&postToLinkedIn("&+postcomment+%&");& | |
render :update do |page| | |
if !liscript.blank? | |
page << liscript | |
end | |
#other page updates here | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def saveliuid | |
user = current_user | |
liuid = params[:liuid] | |
liname = params[:liname] | |
user.li_uid = liuid | |
user.li_name = liname | |
user.save! | |
respond_to do |format| | |
format.js do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="http://platform.linkedin.com/in.js"> | |
api_key: <%=@liapp %> | |
authorize: true | |
onLoad: onLinkedInLoad | |
</script> | |
<script type="text/javascript"> | |
function onLinkedInLoad() { | |
IN.Event.on(IN, "auth", onLinkedInAuth); | |
$('#usingstoredLI').hide(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddLiuidToUsers < ActiveRecord::Migration | |
def self.up | |
add_column :users, :li_uid, :string | |
add_column :users, :li_name, :string | |
end | |
def self.down | |
remove_column :users, :li_uid | |
remove_column :users, :li_name | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
@graph = Koala::Facebook::GraphAPI.new(user.fbaccess) | |
str = "hello fb world" | |
link = HOSTURL+"/comments/"+id #hostURL is an env variable for us | |
returnstr = @graph.put_wall_post(str,{:name=>"linkName",:link=>link}) | |
rescue | |
#eventually we'll have more logic here, but we basically turn it off for now (no more posts if failure) | |
user.fbaccess = nil | |
user.fbusername = nil | |
user.fb_uid = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def savefbuid | |
user = current_user | |
fbuid = params[:fbuid] | |
fbaccess = params[:fbaccess] | |
user.fb_uid = fbuid | |
user.fbaccess = fbaccess | |
@graph = Koala::Facebook::GraphAPI.new(fbaccess) |