Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1.29 KB

2013-12-20.md

File metadata and controls

53 lines (36 loc) · 1.29 KB

deepak

Clojurescript and persistent data structures

http://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/
https://github.com/swannodette/om
http://swannodette.github.io/mori/

The benchmark numbers shown seem awesome
Not suprising that Clojure peeps are applying persistent data structures everywhere
It seems to their hammer :-)
Also am envious how they can write javascript using full clojure

see sql generated by ActiveRecord on console

I have this little snippet in my .irbrc file

if defined? ActiveRecord
  ActiveRecord::Base.logger = Logger.new(STDOUT)
end

Running ActiveRecord commands on the console prints the SQL as well.
useful for learning and debugging

Hemant

Extending pry for frequently run rails method

Often in Rails I run following command:

User.find_by_identifier("usr-abcde")

It is especially applicable to Brightbox Honcho because each resource there has a alphanumeric identifier. I got really tired of typing this in console and added following bit to .pryrc:

if defined?(ActiveRecord::Base)
  class ActiveRecord::Base
    class << self
      def [](id)
        find_by_identifier(id)
      end
    end
  end
end

With this now I can:

User["usr-abcde"]