Skip to content

Instantly share code, notes, and snippets.

@krishan
Created March 13, 2014 10:23
Show Gist options
  • Select an option

  • Save krishan/9525779 to your computer and use it in GitHub Desktop.

Select an option

Save krishan/9525779 to your computer and use it in GitHub Desktop.
def kittenize(obj)
puts "uploading kitten..."
kitten = Image.create(
_path: "/egal/#{rand}",
blob: File.new("/Users/krishane/Desktop/kitten.jpg")
)
puts "kittenizing..."
obj.update(
main_content: obj.main_content.map do |widget|
if widget.is_a?(TextWidget) && widget.content.include?("<pre>")
puts "programmer stuff detected, inserting kitten..."
TwoColumnWidget.new(
left_column: [widget],
left_column_width: 9,
right_column: [ImageWidget.new(source: kitten)],
)
else
# no programmer stuff
widget
end
end
)
end
@kostia

kostia commented Apr 11, 2014

Copy link
Copy Markdown

Maximize the cuteness!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment