Category: Tech Stuff

Rails controller namespaces

Mainly used if you have actions on the same controller that deals with “admin” and “non-admin” users. This eliminates the need to put a lot of redundant checking on actions just to differentiate from these roles. And also, it’s a nice way to organ…

(D3 || Dota2) == sleepless nights

Before May 15, 2012, I had no interest whatsoever on Diablo 3. I haven’t played Diablo 1 or 2 before and I didn’t know the story either. When I was in high school, this game “Diablo 2” was all over the internet cafe. I tried playing it once, but I…

Ruby .detect array function

When i search items in an array in Ruby, I usually go with the select method, and get the first item it finds. result = [3, 5, 1.3, ‘sample text’, nil, 7].select{|item| item.is_a?(Integer) }.first The problem I have with using select is it always …

get a grip on grep

how to use grep on searching a text on files I usually use this syntax with these options: grep -nrwi * -n to show line number * -r to find also in subfolders * -w to search the whole word only, ie. “bill” text does not find “billings”, “bills”, “…

Assign width to span tag

Usually, you cannot directly assign width to a tag because it defaults to an inline style. And that the width you assigned will have no effect. Width property can only be assigned to elements that behaves like a block (i.e div).. But if for some r…