zippyy / tumblr

A clone of tumblr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tumblr Clone

In this project I cloned the popular blogging site tumblr.

The live version is up here

Some of the technologies featured include:

Polymorphic Associations

Posts can be of different types ie: Text, Quote, Photo.

All posts share some datafields ie: post_date, user_id

To avoid having to:

all_posts = current_user.text_posts
all_posts = all_posts.merge( current_user.photo_posts ).

the Post Model holds a field 'content_type' which is a string reference to the model name of the content the post holds. Thus to access a posts content I can use:

// in post.rb
def content
  return false unless self.content_type
  self.content_type.constantize.find_by_post_id(self.id)
end

Amazon Cloud Storage.

None of the photos are held on heroku. Use the paperclip gem to store my photos in a bucket at AWS.

Rich Text Editor Plugin

There are indeed many plugins to do rich text editng ( tinyMCE, nicEdit ...). After playing with both a little I discovered that the meat of what they do is centered around this command:

document.execCommand()  

So I spent a day writing my own library for repeated use that fits my needs. Rome was not built in a day, while functional there are bugs listed in issues. And it works only in Chrome.

Nokogiri Content

The content is scraped from popular real tumblr pages with the gem nokogiri.

About

A clone of tumblr


Languages

Language:Ruby 49.3%Language:JavaScript 20.7%Language:HTML 15.9%Language:CSS 14.1%