Time-zone issues in Daylight
Issues with Daylight Zones and How to handle them. Background of RV Tasks: In Realvolve app, we had Tasks(Something that needs to be done), Also we had Repeating-Tasks(Something that needs to be to done at regular interval). Normal Task: had one occurrence as its a one-time task. Repeating-Task: had many occurrences, for which we need to track status of occurrence. Ex: Repeating-Task: Attending classes for 60 days continuously. Here there are 60 occurrences for which we need to track status like completion(Attended class). Now, let's dive in Time-zone issue related to daylight. Don't know DST? follow the
Working with Rails Time-zone
How to work with time-zone in rails Time-zone leaks: This is an issue where time-zone of one request is passed to another request. Ex Scenario: Lets say we have web-server running on a single dyno and we have three different users with different timezones('Mumbai', 'Central America' and 'London'). Here is my code setup that will produce time-zone leaks, class UserController def method_one_with_time_zone puts Time.zone #before_filter sets the time zone for this method execution. end def method_two_without_time_zone puts Time.zone #This method doesn't call any before filter, So it will
Code Review
Code Review Hello Everyone, I have reviewed a codebase of one of our projects. It was a good experience. Few good things. Really clean code. Small methods. I had to travel 5 months back commits to find some bad code. :) Things to improve on: Found less specs, But it is possible that specs have been covered already. Overall Thoughts: The code is super clean, liked it!. fantabulous work folks! Snippets: Code: Menu.pluck(:hyphenated_name) Suggestion: This can be moved to class method which can be cached instead of firing the queries in the app again and again, one problem
PJAX Related performance improvements
PJAX Related performance improvements To know about PJAX [(Click Here)(Pjax Railscast)][1] Post from Kavita: [How to PJAX][2] Pjax is a great solution when we want to do partial refreshing of page at the same time maintaining the history of user navigation, But it has few issues when the app grows Basically PJAX works like this, Issuing a PJAX request to refresh the section of the page( eg: #conainer). Basically it fires an html ajax. Rails server handles the html request and renders the complete html page. These html template is parsed by the middleware, which removes the
Git aliases and load it through a file in to terminal
Git Aliases and set it up in UNIX I have created a list of git aliases that can be used in our day to day work. Most of us might have configured this. But I have listed few more aliases that are normally not used. like 'ggr' # Add and Removes alias "ga"='git add' alias "gai"='git add -i' alias 'grm'='git rm' alias 'gra'='git remote add' alias "grr"='git remote rm' # Commit and Pushes alias "gcm"='git commit -m' alias "gca"='git commit -am' alias "gp"='git push' alias "gpu"='git pull' alias "gpo"='git push origin' alias
Useful Links on Rspec, Cucumber, Capybara,TDD, BDD
Hello Everyone, I wanted to share few links that Swapnil shared with me in the past. All of the links were really great. So I am sharing it here. Also if possible, just take an hour to go through the links. They are really good. If you guys find any good links other than the ones I give below, please post them as comments.So that this post can help someone who needs good references for the specs in the future. https://github.com/jnicklas/capybara https://gist.github.com/zhengjia/428105 :capybara cheat sheet http://eggsonbread.com/2010/09/
Cheat Gem to Get Cheats.
This gem is not something that you are going to use in project, However, This will help you to get all the cheatsheats, that will help us in getting up to speed. Setting up cheat gem gem install cheat The first command u need to try out is the sheets cheat cheat : How to use cheat gem cheat sheets : Show list of available lists in console. This will give u a list of available sheets like: git, cucumber, rspec, svn, ssh, loose_weight etc. The list is also growing continuesly How to use this, cheat git cheat cucumber If you
Suggestions On Redis, Backing-Up Redis And Setting up production environment for redis
Redis installation at local is one of the easiest things to do. However, There are some gotchas involved when we are trying to use redis. Running redis-server without config(Default Config File will be picked). When we run redis-server without config, then it creates a dump.rb(A physical file to store all data related to redis) at the folder from which we are starting the redis. We normally, don't realize the impact of this issue as we start the redis server at the same project folder every-time. However, If we start the redis from the some other folder, then
Parsing Yaml Files in Javascript.
Why we need YAML parser. As long as we are working in rails we will hardly face a situation, where we have to parse the YAML files in javascript.However when we are planning to work on node.js OR tideSDK where javascript is the heart of everything, then in that case we need something to parse the configs and then writing to configs if necessary. There are many parser available to read the YAML. But there are very few which does the reverse good. I found just two plugins like that. One plugin was bit confusing and it had
Alternative way to highlight the current active page
This post is very much similar to the post of Abhijit. [Highlight the active page (Highight the active page)][1] by Abhijit. This would work very well if we have simpler routes, if we have complex routes(Modular routes) in our app where we have similar urls with same action then we need to enhance this approach. For e.g There are three links on the same page as follows. 'web/dashboard' 'mweb/dashboard' 'mapp/dashboard' All these are pointing to same action. i.e Dashboard. So selecting active tab based on action name will fail here and will highlight