How I Patched Devise to Force Login for Twitter and Facebook

Here were some of the things that I had to do to Devise to get things working correctly with Twitter and Facebook. YMMV, as this was six months ago and I had some special requirements potentially.

# config/initializers/omniauth_patch.rb
# see http://stackoverflow.com/questions/1960957
module OmniAuth
  module Strategies
    # override authorize path to force user to login each time
    class Twitter < OmniAuth::Strategies::OAuth
      def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block;)
        client_options = {
          :site => 'https://api.twitter.com'
        }

        client_options[:authorize_path] = '/oauth/authorize'
        super(app, :twitter, consumer_key, consumer_secret, client_options, options)
      end
    end
  end
end
# config/environments.rb
config.omniauth :twitter, 'XXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

# Created multiple Facebook apps for testing because you can only have
# one per domain. One way to lessen these would be to set up staging.myapp.com, etc.
# since Facebook respects subdomains as being on the same domain. Would still need one for
# localhost testing though (unless I set up hosts file differently?)
# This seems simplest for now though.
id, secret = case ENV['RACK_ENV']
when 'production'
  ['XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX']
when 'staging'
  ['XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX']
else
  ['XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'] # localhost
end
config.omniauth :facebook, id, secret, { :display => :touch }

The last line ensures that we use the facebook touch view because I was only targeting mobile devices (iPhone). I’m not sure how we would easily do this at runtime besides further patching. Basically this limits us because we have to use the touch even though we want to use the web version on the web.

Read on →

How to Write Without Reservations

Here’s a pep talk that I give to myself when thinking about not writing about something

The talk

You have a reasonably well founded position, you almost certainly have enough to write about. You have arguments and counterarguments for the major things people are going to say. You have experiences that no one else has. So just write them out. Who can argue with what you have experienced? You’ve already done the hard work of thinking about this problem, why not get the benefits of writing it out? If anything, this will help clarify the thoughts that you have.

The specific phrases don’t matter, as long as you are getting out the main thoughts. You can always refine it over time–the great is the enemy of the good here. That’s what the edit functionality is for. I know you would love to include a beautiful graph or venn diagram to illustrate something, but just say it now and add it later if you must.

Read on →

Formal Skill Modeling

I think people should create a formal model of their knowledge portfolio and use this model to actively manage their knowledge and skill acquisition. This applies both to organizations and individuals. I could see this looking similar to the Thoughtworks technology radar. The skill model would have a list of skills and interests and how much knowledge one has in these. Experience could range from:

  • hearing about something
  • reading a book about it
  • knowing a similar technology
  • writing a Hello World program
  • doing a small project in an area
  • having years of experience doing something

I think there could also be a weighting as to how much the person feels like they know a particular area. Maybe they “read” a book but didn’t feel like it really sunk in. Perhaps they don’t know a particular technology, but have two good friends who are well versed in that technology and can help in a pinch or introduce them to people in that space. In this way, an overall view of what a person has done and may be capable of can be more easily assessed. Take for instance someone has not done much C# but has done a lot of Java development. By understanding that these technologies are similar, someone outside of the development field can understand that this person has a higher capability for C# than in, say, embedded development.

Read on →

How to Look Like You Can Accurately Predict the Future of Technology

It seems like the most devastating career risk people face is getting stuck doing one thing for too long without branching out. As a result, they become unemployed or underemployed, doing work that is not challenging, poorly paid, or nearing obsolescence. To this end, I have a framework that I currently use to think about the next few years of career development and being proactive about learning. I think about it mostly from the software contracting and business consulting perspectives, although it could be applied to other disciplines. I think the big differentiator is how quickly the field changes and how much one feels a need to hedge their career options.

It’s useful to note that all of the following stages are generally in play at any given time. If you focus only on the future, you might starve. If you focus only on the present, you might become short-sighted and hurt long term results. The idea is that one should have:

  • a list of skills that have general value today,
  • a list of skills that are becoming obsolete, and
  • a list of skills that just might become very useful in the near future.

Essentially, it’s skill diversification, much like people diversify stock holdings.

The Cash Cow

This is something that you are very good at and is currently in hot demand. It differs from a core competency because this is something that you can make money doing for the near foreseeable future. This is web programming (and others) in the late 1990s. This is probably Ruby (and others) today. It might be something else tomorrow. Hopefully you will have learned enough about tomorrow’s cash cow in the second phase (small bets) to be good at it when it changes.

There are different kinds of cows. It could be that COBOL programming is the thing you are best at and can easily find a variety of work for. This would fit the criteria that I laid out. You might have some that are solid, and some that are getting to be less profitable.

Read on →