Hi

I'm Sean.

I write about #software, #SaaS, #consulting and #mobile app development

I code in #Python, #PHP, #Swift, #Ruby, #ReactJS and #Postgres


Random Blog Posts See more posts

Aliasing Attributes in Ruby on Rails
Alias an attribute with alias_attribute method. The first argument is the name for the new attribute, while the second argument is to identify the attribute that is already defined. class User < ActiveRecord::Base alias_attribute :username, :login ...
Written by Sean Behan on 06/17/2012
Dynamic Attributes in Python Model Class
class Bar(): def __init__(self, **args): for key in args: self.__dict__[key] = args[key] b = Bar(fullname="Monty Python", email="me@monthpython.org") b.fullname #=> Monty Python b.email #=>me@montypython.org
Written by Sean Behan on 06/17/2012
Turn Off SSL Verification In Ruby
The following code will disable SSL verification when using Open SSL. OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE It is probably not a good idea to do this in production. But if you are just testing on your development machine it might...
Written by Sean Behan on 03/02/2017
hessian
Written by Sean Behan on 06/17/2012
How To Write Your Own Time Comparison Function in Ruby Like time_ago_in_words Without Rails
# time_ago_in_words(Time.now, 1.day.ago) # => 1 day # time_ago_in_words(Time.now, 1.hour.ago) # => 1 hour def time_ago_in_words(t1, t2) s = t1.to_i - t2.to_i # distance between t1 and t2 in seconds resolution = if s > 29030400 # seco...
Written by Sean Behan on 10/17/2013