16 days ago
comments
17 days ago
comments
about 1 month ago



Short interview with the guy behind the artwork of Flying Lotus' fantastic album Cosmogramma.

If you don't have it yet get it!!

comments
about 1 month ago




I decided to post more music here. So here's the first one. dBridge who's quite a sensation himself gets the remix treatment by none other than the mighty Shed. London meets Berlin. Dubstep meets Techno. Sancho meets Pancho. Greatness!
comments
4 months ago
Check out my fork of acts_as_soft_deletable.
I added a little extension to ActiveRecord::Migrator to automatically update the columns of the deleted_* tables.
Before this had to be done manually by running
Post::Deleted.update_columns
in your migration everytime you updated the Post table.

I always forgot to do it and thought this might as well be automated. So here's the piece of code that does it all:
module MigratorExtension
  def self.included(base)
    base.class_eval do
      include InstanceMethods    
      alias_method_chain :migrate, :deleted_table_update
    end
  end
  module InstanceMethods
    def migrate_with_deleted_table_update(*args)
      migrate_without_deleted_table_update(*args)
# reloading column definitions, was having issues with Post.columns not reflecting changes  
 ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
 ActiveRecord::Acts::SoftDeletable::Live::InstanceMethods.included_in_classes.each do |klass|
        klass::Deleted.update_columns
        puts "Updated columns of #{klass.name}::Deleted"
      end
    end
  end
end

class ActiveRecord::Migrator; include MigratorExtension; end

First, we wrap the migrate instance method of ActiveRecord::Migrator using alias_method_chain.
In this method we first call the original migrate method. Then we reset the column definitions for all tables, I had problems where Post.columns was not reflecting the just migrated changes and this fixed it (might only be a problem for the app I used it in but doesn't hurt :).

At last, we lookup all classes that include acts_as_soft_deletable and update the columns of the corresponding deleted_* table.

Check it out here:
http://github.com/sens3/acts_as_soft_deletable
comments
5 months ago
As of last Wednesday the completely re-written, enhanced and now-with-super-powers Socialight is live.
We've spent several long nights getting this up on time and I'm proud to be a part of it.

With this re-write we had the chance to do everything better and the right way, with the right tools (everyone who ever had the pleasure of inheriting code knows what I'm talking about). And even though such a big rewrite may have some pitfalls I'm confident we did a good job and delivered a improved and solid platform.
Rails, Rspec, Cucumber, Git. Without these I'd certainly have had a heart attack during the last months. I like being a developer but I love being a Rails developer (I know, I know.. cheesy). My resolution for this year: contribute (more) to open source!

Back to Socialight: here is an article on Adage that, besides the unfortunate title, does a good job summarizing what we do now and why we do it.
In short: If you want to create a community around location based content, we give you a platform to do just that.

I always wanted to create a way to attach songs to the places I associate them with. Trentemoeller at Central Park. NWAQ at The Bunker. De La Soul or ATCQ at that art studio I used to hang out in my teenage days.
You can become a member and access the admin interface here, a (quiet awesome) iPhone app is in the making:

http://cassette.socialight.com


comments
5 months ago
I finally found the time to clean up the delayed_paperclip - plugin I wrote a while back and load it up to Github. You can find it here:

http://github.com/sens3/delayed_paperclip

If you are using Paperclip for media attachments and think about loading the processing off to a background job (delayed_job in this case) this might be for you. Enjoy!
comments
6 months ago
Covers 37 Signals' Sprocket, Authentication with Gigya, Prince (PDF Generation)....
More info and download here.
comments
6 months ago
The following module allows you to call *_count methods on any ActiveRecord Object.
i.e @post.comments_count instead of @post.comments.count

It looks kinda stupid and unnecessary but comes in handy if you have(!) to specify a method by passing a symbol. In my case I was using this in JSON serialization parameters.
@user.to_json :methods => [:post_count, :comment_count]
The module also takes care of the respond_to? method by checking if the given association exists.
module AssocationCounts
  
  def respond_to?(name, include_private=false)
    if as = get_association(name)
      !self.class.reflect_on_association(as).nil?
    else
      super
    end
  end

  def method_missing(name, *args, &block)
    if respond_to?(name) && as = get_association(name)
      self.send(as).count
    else
      super
    end
  end

  private

  def get_association(name)
    if md = name.to_s.match(/^(.+)_count$/)
      md[1].to_sym
    end
  end
  
end

class ActiveRecord::Base; include AssocationCounts; end

Update: made get_association private
comments
9 months ago
This is all over the internets but I'm sick of always having to search for it, so...

 ActiveRecord::Base.logger = Logger.new(STDOUT)

comments