Skip to main content

Posts

Showing posts from June, 2013

Github : ignore files

Recently I have started working with git version control system and I’m loving it, especially the Git bash.  Usually in each and every project there are some files which we don’t want to commit and push on live again and again. For example configuration files and db files once committed don’t need to be modify again for live site. In such cases to stop manual intervention git provide us the facility to ignore files. Let’s discuss:   We can ignore files in two ways. 1) Using .gitignore file :  If you don’t want some files to be added and want to ignore them while uploading on  server, then you can use .gitignore file. For example you have a file named bkp_config.php and while pushing you code live you don’t want to push that file. In such cases you can use .gitignore file.    There are again two scenarios. a)      Files have already been tracked. Means first you have added the files, committed them and then pushed them on master repository. 

JavaScript : Check browser is mobile?

Nowadays, we know that it’s mobile era, so each and every website is having it’s mobile version as well. Some websites will automatically redirect to mobile version when you will try to open it on any mobile device like iPhone, iPad, Android phones etc. So how to check using JavaScript whether the hit is from mobile device or non-mobile device.   You can use the following code for this. //Example <script type ="text/javascript"> // check for the moble site (function(a){is_mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi