.profile Tip

If you are doing development on Linux using a bash shell this is a nice alias a time saver might be to setup some aliases. I am using an alias to start script/server via simply typing ‘ss’. Here’s all you have to do: Jump into your home directory and open hidden file .profile: user@kenyacoffee:~/railz/bort$ cd […]

Shorthand Using a Ternary Operator

This is great for writing short and poignant if-statements in Ruby and IMO makes code a bit more readable. The syntax of the ternary operator: [condition] ? [true expression] : [false expression] Example Usage: [sourcecode language=’ruby’]irb(main):182:0> animal = “Dog” => “Dog” irb(main):183:0> animal == “Dog” ? “You are a Dog” : “WHAT ARE YOU?!?” => […]

Batch Importing and Watermarking with Attachment_fu

In this exercise I had Posts with many image attachments attached with attachment_fu and rmagick. I also had a bunch of old data that i wanted to import in using a rake task and finally all image attachments needed to be watermarked. First my assumptions: “A Post can have many Image attachments” You have the […]

What is here?

Hello All, This blog is designed to function as a sort of journal where i can document code snippets and stuff like that. If you have anything to say, don’t hold back!