diff --git a/github-challenge/githubChallengeBenHall.rb b/github-challenge/githubChallengeBenHall.rb
new file mode 100644
index 0000000..326203b
--- /dev/null
+++ b/github-challenge/githubChallengeBenHall.rb
@@ -0,0 +1,25 @@
+require "rubygems"
+require "json"
+require "open-uri"
+
+github_api_url = open("http://github.com/api/v2/json/commits/list/rails/rails/master")
+
+author = JSON.parse(github_api_url.read)['commits'].group_by { |commit| commit['author'] }
+
+#puts author
+#
Some Person
- Commit: xxxxxxyyyyzzz
Commit Message
+
+html_output = "Ben Hall - Integrum Job Application"
+
+author.each do |k, v|
+ html_output << "#{k['name']}
"
+ v.each do |v|
+ html_output << "- Commit: #{v['message']}
"
+ end
+ html_output << "
"
+end
+
+html_output << ""
+
+output_file = File.new("output.html", "w+")
+output_file.puts html_output
diff --git a/github-challenge/output.html b/github-challenge/output.html
new file mode 100644
index 0000000..170fd41
--- /dev/null
+++ b/github-challenge/output.html
@@ -0,0 +1,44 @@
+Ben Hall - Integrum Job ApplicationAaron Patterson
- Commit: only compute path.to_s once
- Commit: remove to_s implementation so that inspect is helpful
- Commit: * LocalCache strategy is now a real middleware class, not an anonymous class
+posing for pictures.
- Commit: require deprecation so that we can deprecate methods!
- Commit: anonymous classes have blank names on ruby 1.8
- Commit: make sure string keys are always looked up from the class cache
- Commit: Ruby 1.8: Y U NO FUN?
- Commit: use newer class cache api
- Commit: adding deprecation noticies to deprecated class cache methods
- Commit: adding backwards compat for class cache references. <3<3
- Commit: yo dawg, directly use the class cache rather than the cache of the cache
- Commit: refactor Reference to a ClassCache object, fix lazy lookup in Middleware so that anonymous classes are supported
- Commit: initialize ivars
- Commit: Enumerable gives us include?, so remove include?
- Commit: prefer composition over inheritance with AD::MS
- Commit: fixing test case test on 1.9.3dev
- Commit: Revert "compute ext in initialize, and use an attr_reader"
+
+This reverts commit 2dbb73bdda3b81947fd112486ac4285fb1a6e3a9.
+
+Conflicts:
+
+ actionpack/lib/action_dispatch/middleware/static.rb
- Commit: no need to pass a regex to Regexp.compile
- Commit: compute ext in initialize, and use an attr_reader
- Commit: Merge branch 'fuuu'
+
+* fuuu:
+ Move JoinDependency and friends from ActiveRecord::Associations::ClassMethods to just ActiveRecord::Associations
+ Rewrote AssociationPreload.
- Commit: use a subclass of AS::TZ for testing html output
- Commit: reduce two method calls per request, 1 to method_missing and one to send
Alexander Uvarov
- Commit: Add an option to FormBuilder to omit hidden field with id
+
+[#4551 state:committed]
+
+Signed-off-by: Santiago Pastorino
- Commit: Move ActiveModel::AttributeMethods#attribute_methods_generated? to ActiveRecord, so it's flexible now
+
+[#6428 state:resolved]
+
+Signed-off-by: José Valim
Sam Elliott
- Commit: Remove warnings about redefined test methods
+
+[#6490 state:committed]
+
+Signed-off-by: Santiago Pastorino
Cheah Chu Yeow
- Commit: Fix Action caching bug where an action that has a non-cacheable response always renders a nil response body. It now correctly renders the response body.
+
+Note that only GET and HTTP 200 responses can be cached.
+
+[#6480 state:committed]
+
+Signed-off-by: Santiago Pastorino
José Valim
- Commit: log and readme should respect --quiet
Jon Leighton
- Commit: Move JoinDependency and friends from ActiveRecord::Associations::ClassMethods to just ActiveRecord::Associations
- Commit: Rewrote AssociationPreload.
Josh Kalderimis
- Commit: Updated the AS guides with some information on the difference between Date.today and Date.current.
- Commit: updated Time, Date and DateTime current methods in AS to use Time.zone and not Time.zone_default.
+
+[#6410 state:committed]
Dalibor Nasevic
- Commit: No need of instance variable
+
+[#6502 state:committed]
+
+Signed-off-by: Santiago Pastorino
- Commit: Fixed typos in asset_host_test
+
+[#6501 state:committed]
+
+Signed-off-by: Santiago Pastorino
Diego Carrion
- Commit: reverted tests deleted by 080345baca1076a9788d, refactored implementations should not invalidate the validations
+
+Signed-off-by: Santiago Pastorino
- Commit: refactored Time#<=> and DateTime#<=> by removing unnecessary calls without losing performance
+
+Signed-off-by: Santiago Pastorino
diff --git a/refactor-this/helper.rb b/refactor-this/helper.rb
old mode 100644
new mode 100755
index 6ef273b..de804d8
--- a/refactor-this/helper.rb
+++ b/refactor-this/helper.rb
@@ -26,42 +26,32 @@ def display_large_photo(profile, html = {}, options = {}, link = true)
def display_huge_photo(profile, html = {}, options = {}, link = true)
display_photo(profile, image_size(profile, "200x200"), html, options, link)
end
+
+ def has_user_profile_and_photo?(profile)
+ return true if profile.user && profile.user.photo
+ end
+
+ def is_rep_user?(profile)
+ return true if profile.user && profile.user.rep?
+ end
def display_photo(profile, size, html = {}, options = {}, link = true)
- return image_tag("wrench.png") unless profile # this should not happen
+ return image_tag("wrench.png") if !profile
show_default_image = !(options[:show_default] == false)
- html.reverse_merge!(:class => 'thumbnail', :size => size, :title => "Link to #{profile.name}")
-
- if profile && profile.user
- if profile.user && profile.user.photo && File.exists?(profile.user.photo)
- @user = profile.user
- if link
- return link_to(image_tag(url_for_file_column("user", "photo", size), html), profile_path(profile) )
- else
- return image_tag(url_for_file_column("user", "photo", size), html)
- end
- else
- show_default_image ? default_photo(profile, size, {}, link) : ''
- end
+
+ if has_user_profile_and_photo?(profile)
+ return link_to(image_tag(url_for_file_column("user", "photo", size), html), profile_path(profile) ) if link
+ return image_tag(url_for_file_column("user", "photo", size), html)
end
-
- show_default_image ? default_photo(profile, size, {}, link) : ''
+
+ return show_default_image ? default_photo(profile, size, {}, link) : 'NO DEFAULT'
end
def default_photo(profile, size, html={}, link = true)
if link
- if profile.user.rep?
- link_to(image_tag("user190x119.jpg", html), profile_path(profile) )
- else
- link_to(image_tag("user#{size}.jpg", html), profile_path(profile) )
- end
- else
- if profile.user.rep?
- image_tag("user190x119.jpg", html)
- else
- image_tag("user#{size}.jpg", html)
- end
+ return link_to(image_tag("user100x100.jpg", html), profile_path(profile) ) if !is_rep_user?(profile)
+ return link_to(image_tag("user190x119.jpg", html), profile_path(profile) )
end
end
end
\ No newline at end of file
diff --git a/refactor-this/helper_spec.rb b/refactor-this/helper_spec.rb
old mode 100644
new mode 100755
index b82e40e..d034945
--- a/refactor-this/helper_spec.rb
+++ b/refactor-this/helper_spec.rb
@@ -1,8 +1,6 @@
require 'rubygems'
require 'factory_girl'
require 'factories'
-require 'spec'
-require 'spec/autorun'
require 'redgreen'
require 'user_profile'
require 'helper'
@@ -12,8 +10,14 @@
describe "Helper" do
before(:each) do
@helper = Helper.new
+ @helper.stub!(:profile_path).and_return("profile_path")
+ @helper.stub!(:url_for_file_column).and_return("file_column_url")
+ @helper.stub!(:set_image_default_html).and_return({})
end
describe "display_photo" do
+ before do
+ @helper.stub!(:image_tag).and_return("wrench.png")
+ end
it "should return the wrench if there is no profile" do
@helper.display_photo(nil, "100x100", {}, {}, true).should == "wrench.png"
end
@@ -27,6 +31,8 @@
@photo = Photo.new
@user.photo = @photo
@profile.stub!(:has_valid_photo?).and_return(true)
+ @helper.stub!(:image_tag).and_return("")
+ @helper.stub_chain(:link_to).and_return("this link")
end
it "should return a link" do
@helper.display_photo(@profile, "100x100", {}, {}, true).should == "this link"
@@ -42,6 +48,7 @@
@photo = Photo.new
@user.photo = @photo
@profile.stub!(:has_valid_photo?).and_return(true)
+ @helper.stub!(:image_tag).and_return("just image")
end
it "should just an image" do
@helper.display_photo(@profile, "100x100", {}, {}, false).should == "just image"
@@ -52,12 +59,17 @@
before(:each) do
@profile = UserProfile.new
@profile.name = "Clayton"
+ @profile.stub!(:has_valid_photo?).and_return(false)
+ @helper.stub!(:image_tag).and_return("")
+ @helper.stub_chain(:link_to).and_return("default link 100x100")
end
it "return a default" do
@helper.display_photo(@profile, "100x100", {}, {}, true).should == "default link 100x100"
end
end
+
+
describe "When the user doesn't have a photo" do
before(:each) do
@profile = UserProfile.new
@@ -69,6 +81,8 @@
describe "With a rep user" do
before(:each) do
@user.stub!(:rep?).and_return(true)
+ @helper.stub!(:image_tag).and_return("")
+ @helper.stub_chain(:link_to).and_return("default link 190x119")
end
it "return a default link" do
@helper.display_photo(@profile, "100x100", {}, {}, true).should == "default link 190x119"
@@ -79,13 +93,16 @@
describe "With a regular user" do
before(:each) do
@user.stub!(:rep?).and_return(false)
+ @helper.stub!(:image_tag).and_return("")
+ @helper.stub_chain(:link_to).and_return("default link 100x100")
end
it "return a default link" do
@helper.display_photo(@profile, "100x100", {}, {}, true).should == "default link 100x100"
end
end
end
-
+
+
describe "When the user doesn't have a photo and we don't want to display the default" do
before(:each) do
@profile = UserProfile.new
@@ -107,6 +124,8 @@
describe "With a regular user" do
before(:each) do
@user.stub!(:rep?).and_return(false)
+ @helper.stub!(:image_tag).and_return("")
+ @helper.stub_chain(:link_to).and_return("default link 100x100")
end
it "return a default link" do
@helper.display_photo(@profile, "100x100", {}, {}, true).should == "default link 100x100"
diff --git a/resume/Ben_Hall_Resume.pdf b/resume/Ben_Hall_Resume.pdf
new file mode 100755
index 0000000..ca9a77e
Binary files /dev/null and b/resume/Ben_Hall_Resume.pdf differ