AngularJS dynamic filter

Use this to dynamically pass a filter from a controller or somewhere else as a string. It will use DI to lookup the filter and apply it.

In the template

row.label | date | dynamic:nameFilter 

In the controller

$scope.nameFilter = 'mycustomerfilter'; 
app.filter('dynamic', ['$injector', function($injector) {
  return function(text, filter) {
    var result = text;
    if (filter) {
      var f = $injector.get(filter + "Filter");
      if (f) { result = f(text); }
    return result;

Run GIT GC in all subdirectories

Find the release directories and run git gc in each.

find ./ -maxdepth 1 -type d -exec git --git-dir={}/.git --work-tree={} gc \;

Semi Forward Foot Controls for Sportsters ’86 and ’03

These controls place your feet in between the stock mid position and forward controls.4-020bb_s

Short MongoDB Fields with Mongoid

Need to have shorter field name in MongoDB, but still use readable names in code?

# Mongoid Timestamps
include Mongoid::Timestamps::Short

# fields
field :aid, as: :application_id, type:String

# one to one
embeds_one :address, :store_as => :ad

# collections
field :aid, as: :application_id
belongs_to :application, foreign_key: :aid

On Writing – Steven King

Part biography and part writing advice. Both were interesting.

The advise that jumped out is, Do The Work. For writing that’s writing and reading. Which translates well for most things into doing and learning/observing.

On Writing

Rails Routes used in an Isolated Engine

The Problem

I have a rails application an want to add a blog engine to it. In this case the blogit engine. Things are working well until the layout is rendered. It uses the parent applications layout, which is what I want, but because it’s an isolated engine, it doesn’t have access to any of the parent applications helpers, including url helpers.

My Solution

If there’s a better way, please post in the comments.

In the engines config block, I open it’s application helper and add a method_missing definition. Then I check the main_app helper, which is added when the engine is mounted, for a matching helper method, if found use it.


module Blogit
  module ApplicationHelper
    def method_missing method, *args, &block
      puts "LOOKING FOR ROUTES #{method}"
      if method.to_s.end_with?('_path') or method.to_s.end_with?('_url')
        if main_app.respond_to?(method)
          main_app.send(method, *args)

    def respond_to?(method)
      if method.to_s.end_with?('_path') or method.to_s.end_with?('_url')
        if main_app.respond_to?(method)

As a side note, the engine layout can be specified in /app/views/layouts/blogit/application.html.haml.


root_path and root_url are defined for the engine, so those still need to be handled differently. This issue could happend for any routes that overlap.


And the other way if you want to link to the engines root_path. blogit is the engine_name.


Rails Blog Engines

A list of mountable blog engines for Rails.


Blogit Engine

Blogit is a flexible blogging solution for Rails apps. It:

  • Is Rack based;
  • Is a complete MVC solution based on Rails engines;
  • Aims to work right out of the box but remain fully customisable.


JABE Blog Engine

JABE is a bare bones blogging engine that is installed as a gem. It will grow as its needs do.

This version is for Rails 3.1+


Squeaky Blog Engine

Squeaky is a simple mountable Rails engine for making a squeaky clean blog.


Hitchens Blog Engine

  • Mountable blog engine for Rails 3.1+
  • Design/style agnostic – just a blog backend
  • Inspired by radar/forem


Kublog Blog Engine

Kublog is a simple yet complete way to have a Product Blog that integrates with your apps user base. It includes social sharing, atom feeds and moderated comments.

Built for Rails 3.1, Kublog is a complete stack, fully configurable solution.

  • Publish posts with the most basic and simple wysiwyg
  • Attach multiple images to your content
  • Share your posts on your Product’s Twitter Page and Facebook Fan Page
  • E-mail personalized versions of your posts to all your users
  • Optional background processing with Delayed Job
  • Moderated comments from apps users, apps admins, and visitors
  • Atom feed for main blog and individual post categories

Brutalist Framework