www.implementingscrum.com -- Cartoon -- September 11, 2006 - Scrum - This is the classic story of the Pig and Chicken metaphor in an Agile Software Development Project Management Technique

Sublime 2 as Textmate replacement

Posted: October 26th, 2011 | Author: | Filed under: Rambling | Tags: , | No Comments »

Just started using the new slick editor Sublime2.
http://www.sublimetext.com/2

Yammer
Uploaded with Skitch!

Here’s some key mappings my colleagues added.
https://gist.github.com/1314816

You would want to get this cucumber syntax highlight too.
https://github.com/sagework/cucumber-sublime2-bundle

Here’s link to documentation:
http://www.sublimetext.com/docs/2/

Enjoy :D


render inline coffeescript in view

Posted: July 20th, 2011 | Author: | Filed under: Rambling | Tags: , | No Comments »

module ApplicationHelper
def coffee_script(&block)
output = CoffeeScript.compile(capture(&block))

concat content_tag(:script, <<-JAVASCRIPT.html_safe, :type => 'text/javascript', :charset => 'utf-8')
// #{output}
//]]>
JAVASCRIPT
end
end


Gamification hotness

Posted: July 19th, 2011 | Author: | Filed under: Rambling | Tags: | No Comments »

starting a blog on gamification at
http://www.gamification101.com


Omniauth Facebook on Heroku

Posted: July 18th, 2011 | Author: | Filed under: Rambling | Tags: , , | No Comments »

https://github.com/intridea/omniauth/wiki/Setting-up-SSL-certificate-locations-in-Linux

Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, ‘YOUR_APP_ID’, ‘YOUR_SECRET_KEY’,
{:scope => ‘PERMISSION_1, PERMISSION_2, ETC’, :client_options => {:ssl => {:ca_file => ‘/usr/lib/ssl/certs/ca-certificates.crt’}}}
end


Rails 3.1 on Heroku

Posted: July 18th, 2011 | Author: | Filed under: Rambling | Tags: , | No Comments »

in your gemfile.
gem ‘rails’, :git => ‘git://github.com/rails/rails.git’, :branch => ’3-1-stable’
gem ‘sprockets’, :git => ‘git://github.com/sstephenson/sprockets.git’

gem ‘therubyracer-heroku’, :group => :production


capybara integration test with selenium for jquery autocomplete

Posted: July 7th, 2011 | Author: | Filed under: Rambling | Tags: , , | No Comments »

Note the ‘sleep 1′, didn’t work for me unless I add a wait in between filling in the autocomplete field and mimicking the select.

fill_in(“Client”, :with => @individual.code)
sleep 1
page.execute_script %Q{ $(‘.ui-menu-item a:contains(#{@individual.code})’).first().trigger(“mouseenter”).click(); }
click_on “Save”


ActiveRecord joint table condition notation/syntax

Posted: June 27th, 2011 | Author: | Filed under: Rambling, Ruby, Ruby on Rails | No Comments »

This doesn’t seem to be that well documented.
When you want to do a conditional where clause on a joint table.

You could do this: Model.where().includes(:model_b).where(“model_b_table.attribute = ?”, ‘foo’)
Better way is: Model.where().includes(:model_b).where(:model_b => {:attribute => ‘foo’) )

The end…


Factory girl singletons

Posted: June 21st, 2011 | Author: | Filed under: Ruby, Ruby on Rails | Tags: | No Comments »

Factory_girl is different to fixtures. There’s no way to define 2 user belonging to the same school. Creating one instance of school, we call it as a singleton method. Here’s a drop in monkey patch that stores the instance in a class variable.


Coffee-script in Rails 3

Posted: May 4th, 2011 | Author: | Filed under: Rambling | Tags: | No Comments »

Since Rails 3.1 will have coffee-script as default. For those eager to try it can easily do so with ‘barista’ gem.

Simply head to: https://github.com/Sutto/barista

Textmate bundles:

https://github.com/yikulju/CoffeeScript-Syntax-Checker-Textmate-Bundle

https://github.com/jashkenas/coffee-script-tmbundle


Remove invalid escape Xml character easily with regular expression in ruby

Posted: January 21st, 2011 | Author: | Filed under: Ruby, Ruby on Rails | Tags: , , , | No Comments »

I am in a project where there is a huge XML file I need to use SAX parser and unfortunately, to further complicate this matter, we encountered this bug:

(Nokogiri::XML::SyntaxError) "xmlParseCharRef: invalid xmlChar value 25"

Turns out that is caused by &#x19; in the document.

So at first I did something pinpoint to this problem before I submit the string to push parser:

data.gsub('&#x19;', '&apos;')

As this kind of an apostrophe in the text.

Turns out, I got another one later:

(Nokogiri::XML::SyntaxError) "xmlParseCharRef: invalid xmlChar value 29"

With some more googling, I realize anything below character x20 is invalid, then I see a funny post:
Removing Invalid XML Character

Works, but not elegant, especially when you know there is something called regular expression in the world.

This is the easiest:

data.gsub(/&#x[0-1]?[0-9a-eA-E];/, ' ')

Of course for character like &#x19; when you want something actually a character replace that, you would definitely need to do your own replace first before you do this sweeping.