diff --git a/example.config.rb b/example.config.rb deleted file mode 100644 index 8b815c6..0000000 --- a/example.config.rb +++ /dev/null @@ -1,4 +0,0 @@ -#Rename this file to config.rb - -USERNAME = "username" -PASSWORD = "password" \ No newline at end of file diff --git a/github_info.rb b/github_info.rb index bdb24f1..1084d65 100644 --- a/github_info.rb +++ b/github_info.rb @@ -1,4 +1,22 @@ require 'github_api' require "#{Dir.pwd}/config" -github = Github.new basic_auth: "#{USERNAME}:#{PASSWORD}" \ No newline at end of file +github = Github.new basic_auth: "#{USERNAME}:#{PASSWORD}" + +github_gen = Github.new + +repos = github_gen.repos.list 'AJLeonardi' #THIS DOES NOT DO WHAT I EXPECT, no idea where it's getting those repos from +repos.each do |repo| + puts repo['name'] +end + +repos = github.repos.list 'AJLeonardi' #This returns my repos! +repos.each do |repo| + puts repo['name'] +end + +repos = github.repos.list 'chrisvans' #this STILL returns my repos -- wtf?? +repos.each do |repo| + puts repo['name'] +end + diff --git a/lolcat_viewer.rb b/lolcat_viewer.rb index a01a217..7088346 100644 --- a/lolcat_viewer.rb +++ b/lolcat_viewer.rb @@ -18,4 +18,6 @@ def self.run(count=1) end nil end -end \ No newline at end of file +end + +LolcatViewer.run(2) \ No newline at end of file diff --git a/my_lolcatz.rb b/my_lolcatz.rb new file mode 100644 index 0000000..b339ebb --- /dev/null +++ b/my_lolcatz.rb @@ -0,0 +1,25 @@ +require 'nokogiri' +require 'open-uri' + +class LolcatViewer + def self.run(n = 1) + return_catz = Hash.new + url = 'http://www.lolcats.com' + links = [] + Nokogiri::HTML(open(url + "/gallery/new.html")).css('.gallery-item a').each do |link| + links << link + end + n.times do + arr_length = links.length + rand_index = rand(arr_length -1) + url_ext = links[rand_index]['href'] + image_obj = Nokogiri::HTML(open(url + url_ext)).css('.picture-container>a>img')[0] + title = image_obj['alt'] + img_url = url + image_obj['src'] + return_catz[title] = img_url + end + return_catz.each do |title, link| + puts "title: " + title +" Link: " + link + end + end +end diff --git a/news_site.rb b/news_site.rb new file mode 100644 index 0000000..e423d9f --- /dev/null +++ b/news_site.rb @@ -0,0 +1,19 @@ +require 'nokogiri' +require 'open-uri' + +class NewOnionArticles + def self.run() + return_news = Hash.new + url = 'http://www.theonion.com' + Nokogiri::HTML(open(url)).css('section.recent-news a').each do |link| + title = link.content + link_url = link['href'] + return_news[title] = url + link_url + end + return_news.each do |title, address| + puts 'Title: ' + title + ' Link: ' + address + end + end +end + +NewOnionArticles.run() \ No newline at end of file