Solution to Ember.js app's frequent failures (Error:FSEventStreamStart)

In our ember.js based project after getting latest code and running following commands: npm install && bower install npm start when I was starting app, it was failing randomly with following error. (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21) events.js:85 throw er; // Unhandled 'error' event ^ Error: watch EMFILE at exports._errnoException (util.js:746:11) at FSEvent.FSWatcher._handle.onchange (fs.js:1161:26) npm ERR! Darwin 14.5.0 npm ERR! argv "node" "/usr/local/bin/npm" "start" .... To solve this issue I

How to auto run `rake db:migrate` after deploying to Heroku

As you know Heroku **does not ** run rake db:migrate automatically. Most of the time we all face this issue of not running migrations on Heroku post deployment. Either we forget or for some reason we miss it. However there are some gems/plugins that help us overcome these issues. Even when we use [heroku auto deployment] [12] feature, there also we need to run rake db:migrate manually and Heroku will not run it automatically for us. That means it is not fully automatic. When I setup heroku auto-deployment I wanted everything to happen automatically, why should I run

Auto-Deployment with Heroku of Github/Bitbucket Source Code

While we deploy our changes to heroku, we use deployment scripts or setup yml in CI server. However Heroku has come up with an auto-deployment feature and for that we do not need to use even command line tools. To take advantage of this feature you should use Github/Bitbucket version control system If your Github/Bitbucket repo is setup and you have already pushed your code to Github then you are good to start with heroku I assume that you already have Heroku account and heroku-toolbelt is setup on your system. Now create an app on heroku for your

RUBY Quick Tip : Share your local folder with everyone over LAN

This is very useful Ruby command to share your local folder with everyone on the same network. Thanks to Rohan! As we were working on something and he wanted me to share my local folder quickly. Rohan shared this Ruby command with me and since then every now and then I am using it in office to share stuff with teams. Command is: ruby -rwebrick -e '>PORT_NUMBER,:DocumentRoot=>”DIRECTORY_PATH").start' e.g. ruby -rwebrick -e '>2121,:DocumentRoot=>”/home/public/picture").start' PORT_NUMBER - Port to listen a request DIRECTORY_

Javascript - Shorthand for Switch statement

You might have seen similar code in javascript. I wanted to understand how it is working. As it does not look like a ternary expression. return { "false": React.DOM.a({ href: "javascript:void(0)", onClick: this.linkClicked }, "Click Me Now"), "true": React.DOM.span({}, "You have clicked") }[this.state.clicked]; While discussing with team we found that, it is nothing, but a SWITCH CASE click her to see shorthand for js So when we execute above mentioned code, if "this.state.clicked" is TRUE then it will show SPAN with text 'You have clicked'". This is just

How to make Active Admin column Html_safe and replace boolean values with some icons in better way

I was working on ActiveAdmin views and as we are using html editor for some of our text fields so we wanted to make sure when we are showing that html content in the application. It should be readable and without html tags. To do that generally it is mentioned to use a block for the field and use .html_safe method. However I did not like this approach, as we have too many fields where I have to call html_safe method and I was not keen to write block for each fields. I know :) I am lazy in

Use Jquery - document.ready() to load page specific javascript in Rails App

Yesterday I was working on one of our portal (It's in Ruby on Rails and we have used quite alot jquery as well). Was integrating a nice Photo Gallery plugin on one of the page. Applcation is having many pages. Every page has some different behaviour and we have different jquery calls for that as per need. For a performant application, we always want to avoid any unwanted calls to different methdods/functions. In my case, as I mentioned earlier I wanted to show Photo Gallery on a page and photo gallery loads as soon as page is loaded. Gallery

Quick Tips for Programming

I thought to create a quick tip post which is kind of lesson learnt, so that every time I learn something can add here and which could help others too. These examples here are not something I have created to support the points which I have mentioned below. Whereas these are the real code snippets of a project. Where team has written code in this manner and given feedback to improve their code. So I thought it would be better if I write a Lesson learnt post which could help other to be aware of mistake they can make while

Send Email with Attachments using Postmark API

From last two days we were running into an issue with the Postmark API based email attachments, specially when you have to use the remote file url for the attachment. Also we were not seeing any error logs for non-delivery of attachments. So Swati and I started with different approaches to solve the problem. I will be explaining here the approach where I directly used the Postmark API key and tried to send an attachment with email using CURL command. Whereas Swati will soon add here post about sending email with attachment using postmark-rails gem and what was causing issue

One more nice and better way to "public share" your local application

Few months back we had a nice - fast and reliable localhost tunneling solution post by Swapnil.I am extending it further. Pagekite and localtunnel both the solutions are really good. However both has some drawback or limitations. e.g. For Pagekite you should have an account on Pagekite site and that login will last only upto 30 days or so. However most of the time you do not need Public sharing of the app all the time For localtunnel the only drawback is change of url every time you start it. However in practical scenarios some times