public
Fork of Caged/gitnub
Description: A Gitk-like application written in RubyCocoa that looks like it belongs on a Mac. See the wiki for downloads and screenshots.
Homepage: http://alternateidea.com
Clone URL: git://github.com/dysinger/gitnub.git
Search Repo:
Don't replace the person image with the standard gravatar image if no 
gravatar is found
kballard (author)
Sun May 04 23:40:26 -0700 2008
commit  e11c191e7c2694acba0bf585599f61def57a5639
tree    3b0f99d0ad496d68a3c2af7f00ce05f8e2487ad7
parent  c9587145dc689c8234305c56110adcb007cd0063
...
10
11
12
13
 
14
15
 
 
16
17
18
...
10
11
12
 
13
14
 
15
16
17
18
19
0
@@ -10,9 +10,10 @@ require 'osx/cocoa'
0
 require 'md5'
0
 require 'cgi'
0
  
0
-def gravatar_url(email, size=36)
0
+def gravatar_url(email, size=36, default="x-img://default")
0
   hash = MD5.hexdigest(email.downcase)
0
- NSURL.URLWithString("http://www.gravatar.com/avatar.php?gravatar_id=#{hash}&size=#{size}")
0
+ edefault = default.gsub(/[^a-zA-Z0-9_-]/) { |s| "%%%02X" % s[0]}
0
+ NSURL.URLWithString("http://www.gravatar.com/avatar.php?gravatar_id=#{hash}&s=#{size}&d=#{edefault}")
0
 end
0
  
0
 class CommitsController < OSX::NSObject
...
73
74
75
 
 
 
 
 
 
 
 
 
 
76
77
78
...
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
0
@@ -73,6 +73,16 @@ class ImageLoadOperation < OSX::NSOperation
0
     setFinished true
0
   end
0
   
0
+ def connection_willSendRequest_redirectResponse(connection, request, redirectResponse)
0
+ if request.URL.absoluteString == "x-img://default" then
0
+ # we're already showing the default image
0
+ connection.cancel
0
+ setExecuting false
0
+ setFinished true
0
+ end
0
+ request
0
+ end
0
+
0
   private
0
   
0
   def setExecuting(bool)

Comments

    No one has commented yet.