-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
209 additions
and
243 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Main controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
class MainController < ApplicationController | ||
def index | ||
redirect_to "/#{params[:twitter_id].first.gsub "@", ""}" if params[:twitter_id] | ||
end | ||
|
||
def show | ||
@twitter = params[:twitter_id] | ||
user = Twitter.user @twitter | ||
@timezone = user.time_zone | ||
@avatar = user.profile_image_url | ||
@url = user.url | ||
@name = user.name | ||
@location = user.location | ||
|
||
@sites = { | ||
:aboutme => "http://about.me/#{@twitter}", | ||
:github => "http://github.com/#{@twitter}", | ||
:twitter => "https://twitter.com/#{@twitter}", | ||
:facebook => "http://facebook.com/#{@twitter}", | ||
:gravatar => "http://en.gravatar.com/#{@twitter}", | ||
:blogspot => "http://#{@twitter}.blogspot.com", | ||
:disqus => "http://disqus.com/#{@twitter}", | ||
:wordpress => "http://#{@twitter}.wordpress.com", | ||
:tumblr => "http://#{@twitter}.tumblr.com", | ||
:deviantart => "http://#{@twitter}.deviantart.com", | ||
:picasa => "http://picasaweb.google.com/#{@twitter}", | ||
:flickr => "http://flickr.com/#{@twitter}", | ||
:lastfm => "http://last.fm/user/#{@twitter}", | ||
:soundcloud => "http://soundcloud.com/#{@twitter}", | ||
:hulu => "http://hulu.com/profiles/#{@twitter}", | ||
:ustream => "http://ustream.tv/user/#{@twitter}", | ||
:vimeo => "http://vimeo.com/#{@twitter}", | ||
:digg => "http://digg.com/users/#{@twitter}", | ||
:foursquare => "http://foursquare.com/#{@twitter}", | ||
:stumbleupon => "http://stumbleupon.com/stumbler/#{@twitter}", | ||
:twitpic => "http://twitpic.com/photos/#{@twitter}", | ||
:yfrog => "http://yfrog.com/user/#{@twitter}/profile", | ||
:linkedin => "http://www.linkedin.com/in/#{@twitter}", | ||
} | ||
|
||
#aboutme = search("site:about.me \"#{@twitter}\" #{name}") | ||
#if aboutme | ||
# doc = Nokogiri::HTML(open(aboutme)) | ||
# raise doc | ||
#end | ||
#linkedin = search("site:linkedin.com \"#{@twitter}\"") | ||
end | ||
|
||
private | ||
|
||
def search(query) | ||
q = GScraper::Search.query(:query => query) | ||
"#{q.top_result.url.scheme}://#{q.top_result.url.host}#{q.top_result.url.path}" | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
module ApplicationHelper | ||
def get_target(key) | ||
[:facebook, :github, :flickr, :hulu, :picasa, :twitter].include?(key) ? "_blank" : "iframe_a" | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module MainHelper | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Click on a profile to view it! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div id="main"> | ||
<h1>Enter your Twitter username</h1> | ||
<%= form_tag do %> | ||
<%= text_field :twitter_id, nil %> | ||
<%= submit_tag "Go!" %> | ||
<% end %> | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div id="container"> | ||
<h1>@<%= @twitter %></h1> | ||
<p><%= @name %></p> | ||
<p><%= @timezone %></p> | ||
<p><%= @location %></p> | ||
|
||
<ul id="navlist"> | ||
<% @sites.sort.each do |key, value| %> | ||
<li><%= link_to key.capitalize, value, :target => get_target(key) %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
|
||
<iframe src="http://<%= @twitter %>.com" name="iframe_a"></iframe> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
task :search => :environment do | ||
twitter_id = "excid3" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
STDOUT.sync = true | ||
|
||
task :search => :environment do | ||
|
||
end |
Oops, something went wrong.