Integration of jquery-timeago in ember application

Timeago is a widely used jQuery plugin which makes it easy to support automatically updating timestamps. (ex: 2 minutes ago) plugin documentation: http://timeago.yarp.com/(link) Now we will see how to integrate timeago jquery plugin in ember application. (Here we will give example using ember-cli) install jquery-timeago plugin using bower bower install jquery-timeago In Brocfile.js app.import('bower_components/jquery-timeago/jquery.timeago.js'); Create Ember Component to display time format app/components/time-ago.js import Ember from 'ember'; export default Ember.Component.extend({ timeValue: new Date(), didInsertElement: function() { Ember.$().ready(function (){ Ember.$('time.timeago').timeago(); // update every

apipie-rails gem: best documentation tool

Apipie-rails is a DSL and Rails engine for documenting you RESTful API. Instead of traditional use of #comments, Apipie lets you "describe the code by code". This brings advantages like: It uses ruby syntax Reusable doc for other purposes (Best for validations) Easier to extend and maintain apipie-rails gem owner has documented it in very nice way with examples. Refer [Github Documentaion(github doc)][1] Path to documentation: The documentation is available right in your app (by default under "/apipie" path.) Also you can provide your own path using initializers. For more information refer [here(config

Want to Learn Ember.js? Start Here..

Ember is awesome but it will take some effort to get started with. Here I would like to share collection of getting started resources to make thing easier for those who trying to learn. Introduction: Building Web Applications with Ember.js – Yehuda Katz has explained very nicely that how Ember can be used to build fast and responsive apps, and also shared some nifty aspects of Ember you might not know about. [http://www.youtube.com/watch?v=u6RFyVN9sNg(video)][1] Basics: Ember Guides – This is the official documentation provided by ember.js developer team. It has everything explained explained

Reviewed code snippets

Hello Team, In last week, I got the opportunity to review the latest code commits from one of our application. It was a very good experience for me to learn many new things from it. For the following code snippets, I have also added few suggestion from my part, they may be relevant or not, as am not aware of what exact functionality is performed by those snippets. As per my thinking, the developer who add the lines of code knows more about it and also knows how he can improve it more better than any other code-reviewer. So please

send email attachments via postmark-api

Previously, I have added post on send email from application via postmark. [Check Here..][1] Now will see how to send attachment with email. In rails, action-mailer provides an easy way to add attachment file as attachments['filename.jpg'] = File.read('/path/to/filename.jpg') Links: [rails-guide-on-attchments(send attachments with email)][2] , [rails-attachments][3] Sending attachments via Postmark-api require "open-uri" def send_refer_pt_request(params, attachment) # attachment -> url of file saved on S3 if attachment.present? mime_type = MIME::Types.type_for(attachment).first url_data = open(attachment).read() attachments["#{attachment.split('/').last}"] = { mime_type:

public_activity gem

public_activity is the best gem for easy activity tracking of models and easy to integrate in your rails application. links: Github-doc, Demo STEPS: In your gemfile: gem 'public_activity' Generate migration for activities and migrate the database (in your Rails project): rails g public_activity:migration rake db:migrate Include PublicActivity::Model and add tracked to the model you want to keep track of: class Answer now, by default create/update/destroy activities are recorded in activities table.(basic CRUD actions) Displaying activities: (see more details) controller: def index @activities = PublicActivity::Activity.all end views: public_activity looks for

jquery.pageless plugin for infinite pagination with scroll

Pagination in Rails Application: Kaminari and will_paginate are the mostly used and the best gems for pagination. Also if you want to go for pagination on scroll with link for ex. “Load More Result” (as we have for activities in knowbuddy), then it is also easy with this gems. You can check this tutorial(Tutorial) Pagination with infinite scrolling: But if you want to have pagination as we have in facebook, without any load-more link, just display result as we scroll down through the page, then here you can make use of this plugin jquery.pageless [Github link(Github

jquery ketchup-plugin for Client-side form-validation

jquery ketchup-plugin for Client-side form-validation: There are many jquery plugins available for client-side form validation (to validate form before actually submitting it). jquery ketchup-plugin is one of them. Github: https://github.com/mustardamus/ketchup-plugin Demo: http://demos.usejquery.com/ketchup-plugin/ Validations provided by plugin: https://github.com/mustardamus/ketchup-plugin/blob/master/jquery.ketchup.validations.js Steps: include css file in your application.css file *= require jquery.ketchup include js file in your application.js file //= require jquery.ketchup.all.min Form: = simple_form_for(@user, :html => {:class => 'ket-validation'}) do |f| = f.input :first_name, input_html: { class: "required_field "} = f.

Send email from application via postmark

Postmark is widely used email delivery service for the web application. The “Postmark-Rails” Gem is a drop-in plug-in for ActionMailer to send emails via Postmark. Links: Postmark-app(Postmark-app) , Postmark-rails gem(Github Doc) , Postmark Developer’s Blog(Postmak Blog) To integrate it with your application: Create an account on postmark.com (it also provides free account), set your-email as sender’s signature. This email-signature only you can use to send email, by setting it in from address. In you environment files: (staging/ production) POSTMARK_API_KEY = your_postmark_api_key config.action_mailer.delivery_method = :postmark config.action_mailer.postmark_settings