27 Jul 2015
In my recent project, I had a chance to use Nokogiri to pull HTML from remote server to get title of the page. There might be a simpler way but my approach was below:
And I thought it might be ...
19 Jun 2015
When you have bunch of stuffs in your room, how do you organize things so that it is easy to find something when you need them? One way can be putting them into different chest drawers and boxes, then label them properly. This is easier than putting all the stuffs in one big box then try to find the ...
1 Jun 2015
I think it's still undocumented but Google Docs provides a very good embeddable PDF reader for any online PDF. You don't even have to upload the document to Google Docs to use this.
<iframe src"https://docs.google.com/gview?urlhttps://www.trustedtherapies.com/general_questions_for_my_doc ...
28 Apr 2015
Vertically aligning elements in CSS is always a headache to me. Found a good solution from a blog.
The gist is:
12 Apr 2015
stub :controller_name, 'discussions' do
active_link_html link_to_nav name: 'Forum', url: discussions_path
inactive_link_html link_to_nav name: 'Webinars', url: webinars_path
12 Apr 2015
I had a table called `answers` and it has `created_at` timestamp column among others. How can I get all the records from the table grouped by week number of the year?
The first idea that came to my mind was to use `group_by` method of Ruby. To do that I would have to run a query like this:
21 Feb 2015
If you have an app using [MonBan](https://github.com/halogenandtoast/monban) you might be using helpers like `current_user` in view layer.
How do you write functional test for it? I ran into this error when I tried.
ActionView::Template::Error: undefined method `user' for nil:NilClass ...
8 Feb 2015
Ruby provides convenient methods to find a minimum or a maximum value in an array.
numbers [23, 20, 35, 3, 8]
> [23, 20, 35, 3, 8]
> [3, 35]
ref: http://www.rubydoc.org/core2.2.0/Enumerable.html ...