URL url = new URL("https://dev.psigate.com:7989/Messenger/XMLMessenger");
				HttpURLConnection connection = (HttpURLConnection)url.openConnection();
				connection.setDoInput(true);		
...

Java PSiGate

by danielharan, January 30, 2009 01:46, 4 refactorings, tagged with xml, psigate, cc, webservice

This seems particularly egr...

880cbab435f00197613c9cc2065b4f5a Talk
biggest_square = 0
[1,4,3,5].each do |base|
  (temp = square(base)) > biggest_square && biggest_square = temp
...

Ruby On Conditional Assignment

by danielharan, September 21, 2008 19:38

Tien - I voted 5 for your 2...

880cbab435f00197613c9cc2065b4f5a Talk
def square(number)
  return number**2
end
...

Ruby On Conditional Assignment

by danielharan, September 21, 2008 16:23 Star_fullStar_fullStar_fullStar_full

Tien Dung's last function i...

880cbab435f00197613c9cc2065b4f5a Talk
for feedback in @feedbacks
  1.upto(20) do |i|
    # unless (answer = feedback.question(i)).nil? # lets you avoid a second call
...

Ruby On Horrible loop

by danielharan, September 17, 2008 14:29

Trying to remove more dupli...

880cbab435f00197613c9cc2065b4f5a Talk
# For the initial view, there's a better way to keep track of 'count'
# each_with_index is in Enumerable
<ul id="lastfm_update_list">
...

Ruby On Think this needs a loop

by danielharan, September 06, 2008 20:31

What Elij wrote. It avoids ...

880cbab435f00197613c9cc2065b4f5a Talk
class Report < ActiveRecord::Base
  belongs_to :reportable, :polymorphic => true
  
...

Ruby A shorter way to declare cl...

by danielharan, August 14, 2008 19:47, 2 refactorings, tagged with rails, ruby, constants

I added these so I could re...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On Same function repeated but ...

by danielharan, August 08, 2008 19:32

The two last methods don't ...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On How to make instance variab...

by danielharan, July 31, 2008 13:51 Star_fullStar_fullStar_fullStar_full

Persistent storage by addin...

880cbab435f00197613c9cc2065b4f5a Talk

Ruby On Contoller refactoring

by danielharan, July 30, 2008 12:32

It doesn't have to be an Ac...

880cbab435f00197613c9cc2065b4f5a Talk
class User < ActiveRecord::Base
  has_many :orders
  has_many :products, :through => :orders
...

Ruby On rails ActiveRecord finder_s...

by danielharan, July 23, 2008 01:42

Here's where I'd see it goi...

880cbab435f00197613c9cc2065b4f5a Talk
module DashboardHelper
  def activity_message_for(object)
    render :partial => "#{object.class.name.downcase.pluralize}/activity"
...

Ruby On Dashboard

by danielharan, July 22, 2008 12:54

Argh - hopefully now I'm aw...

880cbab435f00197613c9cc2065b4f5a Talk
module DashboardHelper
  def activity_message_for(object)
    render :partial => "#{object.class.name.downcase}/_#{object.class.name.downcase}_activity"
...

Ruby On Dashboard

by danielharan, July 21, 2008 23:01

HTML inside helpers is ugly...

880cbab435f00197613c9cc2065b4f5a Talk
class Dj < ActiveRecord::Base
...

Ruby On Password update code

by jamesgolick, July 17, 2008 13:15 Star_fullStar_fullStar_fullStar_fullStar_full

Managing flow with exceptio...

F6eddf2f983d23c2d031e407852625e9 Talk
ERB.new(File.read(path_to_template)).result(binding)

Ruby On Template Method

by jamesgolick, July 01, 2008 14:30

Maybe I'm missing what you'...

F6eddf2f983d23c2d031e407852625e9 Talk
def carrier?
...

Ruby On if else if else

by jamesgolick, June 20, 2008 01:08 Star_fullStar_fullStar_fullStar_fullStar_full

I prefer how this reads (wi...

F6eddf2f983d23c2d031e407852625e9 Talk
function showEMail(element)
{
   var e = { name: 'myemail',
...

JavaScript On Anti-spam Mailto

by jamesgolick, January 08, 2008 04:34

document.write really sucks...

F6eddf2f983d23c2d031e407852625e9 Talk

Ruby On Challenge: Ugliest Ruby Fiz...

by jamesgolick, December 20, 2007 23:55

oh my... I'd like to see so...

F6eddf2f983d23c2d031e407852625e9 Talk
class Fixnum
  def <=>(b)
    self % b
...

Ruby Challenge: Ugliest Ruby Fiz...

by jamesgolick, December 20, 2007 21:54, 8 refactorings

So, after seeing some ugly ...

F6eddf2f983d23c2d031e407852625e9 Talk
update.failure.responds_to %(js html)

Ruby On resource_controller: Redesi...

by jamesgolick, November 05, 2007 22:42

I love those. The *_finder ...

F6eddf2f983d23c2d031e407852625e9 Talk
class PostsController < ResourceController::Base
...

Ruby On resource_controller: Redesi...

by jamesgolick, November 05, 2007 20:28

First refactoring from my b...

F6eddf2f983d23c2d031e407852625e9 Talk
class PostsController < ResourceController::Base
...

Ruby resource_controller: Redesi...

by jamesgolick, November 05, 2007 20:27, 7 refactorings, tagged with rails, resource, restful

Backstory on my blog: http:...

F6eddf2f983d23c2d031e407852625e9 Talk
ROLES = %w( administrator staff )
...

Ruby On restful_authentication role...

by jamesgolick, September 27, 2007 12:06

As an aside, it's helpful t...

F6eddf2f983d23c2d031e407852625e9 Talk
def self.requires_role(role, options={})
  before_filter(options) { |controller| controller.instance_eval { logged_in? && current_user.send("#{role}?") ? true : controller.access_denied } }
end

Ruby On restful_authentication role...

by jamesgolick, September 27, 2007 11:59

Marc's suggestion. Which o...

F6eddf2f983d23c2d031e407852625e9 Talk
def self.requires_role(role, options={})
  before_filter(options) { |controller| controller.send(:logged_in?) && controller.send(:current_user).send("#{role}?") ? true : controller.send(:access_denied) }
end

Ruby On restful_authentication role...

by jamesgolick, September 27, 2007 11:56 Star_fullStar_fullStar_fullStar_full

Problem is, that block seem...

F6eddf2f983d23c2d031e407852625e9 Talk
def self.requires_role(role)
...

Ruby On restful_authentication role...

by jamesgolick, September 27, 2007 10:41 Star_fullStar_fullStar_fullStar_full

So, I added this

F6eddf2f983d23c2d031e407852625e9 Talk