Skip to content

Instantly share code, notes, and snippets.

# read contents of file if it exists and hasn't already been read and it exists
@@_file_contents ||= (File.read(file_name).strip if File.exists?(file_name))
-- or --
@@_file_contensts ||= File.exists?(file_name) ? File.read(file_name).strip : nil
// just logging the output from underscore.js .each function, pulling in some json data.
var portfolio = '<% _.each(projects, function(iimage, iproject, ilink_to_more_copy, iimage_name, pproject_name, pproject_subtitle, pproject_desc, iimage_desc){ console.log("iimage:", iimage, "iproject", iproject, "ilink_to_more_copy", ilink_to_more_copy, "iimage_name",iimage_name, pproject_name, "pproject_subtitle:", pproject_subtitle, "pproject_desc", pproject_desc, "iimage_desc", iimage_desc); } ) %>';
var template = _.template(portfolio, {projects : [{"iimage":"GHI_Mothers2.jpg","iproject":"5","ilink_to_more_copy":"","iimage_name":"","iimage_desc":"GHI Physicians are the types of professionals that can do anything and go anywhere they choose in life. The Mothers Campaign captures the emotion during those once-in-a-lifetime events when their children make them prouder than they ever could have ever imagined. In this campaign, those momentous occasions happen to correspond directly with the choice they make to become p