Tuesday, 6 January 2015

Useful Web Tools..


I am starting to add some useful tools here. Will keep on adding to this list in future too.

==================================================================

Online Learning:-

Javascript Design Patterns
http://addyosmani.com/resources/essentialjsdesignpatterns/book/


==================================================================



http://en.wikipedia.org/wiki/List_of_Unified_Modeling_Language_tools

==================================================================

Brackets - Editor
http://brackets.io/

Brackets is a free open-source editor written in HTML, CSS, and JavaScript. It has some impressive strength like CSS/javascript editing inside HTML page and live update to the browser.

======================================================================

Font Awesome
http://fortawesome.github.io/Font-Awesome/

It provies scalable vector  customized icons  based size, color, drop shadow, and anything that can be done with the power of CSS.

======================================================================

Ripple - Chrome Extension

A browser based html5 mobile application development and testing tool.
Ripple is a multi-platform mobile environment emulator that is custom-tailored to mobile HTML5 application development and testing.

======================================================================

JSON Formatter - Chrome Extension

Makes JSON easy to read. Open source.
FEATURES
   •   JSON & JSONP support
   •   Syntax highlighting
   •   Collapsible trees, with indent guides
   •   Clickable URLs
   •   Toggle between raw and parsed JSON
   •   Works on any valid JSON page – URL doesn't matter
   •   Works on local files too (if you enable this in chrome://extensions)
   •   You can inspect the JSON by typing "json" in the console

=======================================================================

Ad Block - Chrome Extension

The most popular Chrome extension, with over 40 million users! Blocks ads all over the web.
The original AdBlock for Chrome.  Block all advertisements on all web pages, even Facebook, Youtube, and Hulu.


=======================================================================

Widget Logic - Wordpress Plugin

Widget logic enables you to show any widget on certain pages opposite to WordPress default functionality. Highly useful

Tuesday, 30 December 2014

Bower - Simplified - Almost everything




Bower is used for installing and updating packages (frameworks/libraries i.e. jquery, foundation, phonegap and many more) swiftly through command line. It requires Node, NPM and git to run successfully. 


Commands
Note:- Stay in the project folder while running these commands. Angular has been used as an example of a package. Also, I am not covering the installation etc as they are very well defined in the official documentation of Bower. 

#1. bower install angular
 #2. bower uninstall angular
 #3. bower install angular#2.2.1 // Install specific version of the package
 #4. bower info angular
#5. bower update // update all packages
#6. bower install angular // to install only 1 package
#7. bower list // version info regarding all the package
#8. bower search angular
#9. bower init // to generate bower.json file
#10. bower install // install all the packages as per bower.json file dependencies
#11. bower install angular --save // To add the library to bower.json as a dependencies
#12. bower install angular --save-dev // adding only to devDependencies
#13. bower uninstall angular --save
#14. bower cache list
#15. bower cache clean
#16. bower install angular -o // install on offline mode
#17. bower install ../folderName // to install files from local directory
#18. bower uninstall folderName
#19. bower install http://code.jquery.com/jquery-1.11.0.js // install single file
#20. bower install --production // only install production dependency and not install devDependencies
#19. bower install foldername=angular // to install in foldername folder
#20. bower help
#21. bower help install
#22. bower info angular
#23. bower lookup angular
#24. bower prune // uninstall non depency packages
#25. bower install angular -j > output.json // create an output in json file
#26. bower install jquery angular bootstrap --save //multiple package instalation
#27. bower register package-name hithubURL // to register with bower for publishing

General Info
Main configuration file - bower.json
bower.json is used by bower packages to give Bower information that it needs in order to install a package.

.bowerrc file // to set custom location for bower components or library installation. Location of this file must be same as bower.json file.
For eg. - { "directory" : "js/lib" }

Extraneous means - The package is not listed in bower.json file as dependency.

Saturday, 21 July 2012

CSS3 REM unit for font size..

Remember em? Yeah!!..it has been renamed by CSS3 working group..believe that? You don't, actually, em and rem are siblings, rem being the most modern & advanced one.. I will introduce you with that but lets first start with their neighbour..px(pixel) unit.

px has been around ever since I started working and is most consistent and reliable. Most of the UI developers use it but if you are a usability concerned developer, you will not use it. Reason being, Internet explorer users can not use the browser default capabilities are increasing/decreasing the font size.



To over come the text-resizing issue in IE, em has been used for a long time. But the problem with the em based font-size is that the font-size is compound. See the example below. Using 62.5% for body so that I don't need to calculate the em value every time I need to use the unit.


body{font-size:62.5%}
p{font-size:1em} /*10px*/
h1{font-size:1.4em} */14px*/
li{font-size:1.4em} /*14px*/
li li{font-size:1.4em} /*20px*/


em is guided by the font-size of its parent and calculating it again and again can become frustrating at times.


rem has been introduced in CSS3 to overcome both the above mentioned limitations. It just behaves like em but the only difference is that rem values are based on the root element (html or body) and are not affected by the parent font-size value. So, if I use the above mentioned code for rem unit, it will be as follows..

body{font-size:62.5%}
p{font-size:1rem} /*10px*/
h1{font-size:1.4rem} */14px*/
li{font-size:1.4rem} /*14px*/
li li{font-size:1.4rem} /*14px*/

And the interesting thing is that it's supported by all modern browsers including IE9. Though Opera has not implemented rem unit yet. but you always have an option to use px as a fallback for the browsers not supporting rem unit.


p{font-size:14px; font-size:1rem} 

So the browser supporting rem will use rem otherwise px will be used for the browsers not supporting rem. 

Tuesday, 17 July 2012

jQuery CHAINING



The beauty of jquery method is that they return jquery object which can be used further to call another method. This is called COMMAND CHAINING where you can use multiple methods on a single set of elements. This is very helpful in many ways. See the example below.


Without Chaining
<script type="text/javascript">
    $(document.)ready(function(){
       $(“#div1").removeClass(“red");
       $(“#div1").addClass(“blue");
       $(“#div1").css(“border","1px solid #000")
    });
</script>

This script is traversing through the entire DOM and removing class from div ID div1. Then again it’s traversing through the DOM and adding a class blue and traversing through again to add a border. Now, this traversing could have been avoided using jquery chaining. It’s surely going to perform better, saving you from writing unnecessary code and keeping the code cleaner.

With Chaining
<script type="text/javascript">
    $(document.)ready(function(){
      $(“#div1").removeClass(“red")
       .addClass(“blue")
       .css(“border","1px solid #000")
     });
</script>




Thursday, 5 July 2012

Javascript : Displaying day, month and year

Copy this simple javascript code to get you current day, month and year.

See the working example here. http://jsfiddle.net/coolvin21/n7RNh/2/

 <script>
         window.onload = initDate;
           
            function initDate(){
                var dayName = new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
                var monName = new Array("January","February","March","April","May","June","July","August","September","October","Novermber","December");
                var now=  new Date();
               
                var day = dayName[now.getDay()-1];
                alert(day);
               
                var month = monName[now.getMonth()-1];
                alert(month);
               
                var year = now.getFullYear();
                alert(year);
            }
        </script>

Wednesday, 4 July 2012

Javascript adding and deleting node..

Adding and deleting node in javascript is pretty simple. You don't need to use jquery or any other library to accomplish such small tasks like this. See the example below.

I am using a textarea, submit button and an anchor tag to add and delete node through javascript.

Click here to see the working example. http://jsfiddle.net/coolvin21/QUUtk/

<html>
    <head>
        
<script type="text/javascript">
            window.onload = initAll; // CALLING FUNCTION ON WINDOW ONLOAD      
            function initAll(){
                document.getElementsByTagName("form")[0].onsubmit=submitfunc; // FUNCTION ON PRESS OF SUBMIT BUTTON
                document.getElementById("removePara").onclick=removePara; //FUNCTION ON CLICK ON ANCHOR
            };
          
            function submitfunc(){
                var tAareaVal = document.getElementById("tAreaId").value;
                var txtNode = document.createTextNode(tAareaVal); //TEXT NODE OF TEXT AREA VALUE
              
                var pElement = document.createElement("p");
                pElement.appendChild(txtNode); //INSERTING TEXTNODE IN PARAGRAPH TAG
              
                var bodyDoc = document.getElementsByTagName("body")[0];
                bodyDoc.appendChild(pElement); //WRITING INSIDE BODY TAG
              
                return false;
            };
          
            function removePara(){              
                var allGrafs = document.getElementsByTagName("p");
              
                if(allGrafs.length>=1){
                    var lastGraf = allGrafs.item(allGrafs.length-1); //LAST PARAGRAPH WOULD BE ALL PARAGRAPH-1
                    var bodyDoc = document.getElementsByTagName("body")[0];
                    var removed = bodyDoc.removeChild(lastGraf); //DELETING LAST PARA
                }
                else{
                    alert("No ParaGraph Added")
                }
            }          
        </script>
    </head>
    <body>
        <form id="formId">
            <textarea id="tAreaId" cols="30" rows="5">Please type here to add Paragraph</textarea><br />
            <input type="submit" value="CLICK HERE TO ADD PARAGRAPH">
        </form>
        <br /><br /><a href="#" id="removePara">CLICK HERE TO REMOVE PARAGRAPH</a>
    </body>
</html>​​​​​​​​​​​​​​​​​​​​​​​​​

Monday, 2 July 2012

JQuery Before & After Plugin

While working on an e-commerce site I needed a very interactive and interesting  plugin where i could show before and after effects in a single image rather than those two traditional before and after image. And here's what I used. Have a look..

http://www.catchmyfame.com/jquery/demo/7/

http://www.catchmyfame.com/jquery/demo/8/

And it's very simple to use. Remember it requires jQuery UI with JQuery.

<script type="text/javascript">
$(function(){
 $('#container').beforeAfter();
});
</script>


And wrap your images in a div ID container. That's it.

Have it downloaded from here..
http://www.catchmyfame.com/jquery/beforeafter.zip








Learning Coding through Video Tutorials

Video tutorials are a great way to enhance your existing skills or learning new skills. It's a classroom at your own convenience. You can stop, forward or backward and repeat as per your requirement unlike a regular classroom where a professor comes and throws his knowledge at his own speed which might be slower or faster depending upon students' learning capabilities. In case of video tutorials, you can move slowly, pause, rewind and repeat as many times as you want. And the best thing is that you do not even need to go to attend any classes.

But in case of learning coding through Video Tutorials, it comes with a great amount of disbelief or over confidence that we have learnt all that we have watched. You will start behaving or believing that you know all that you watched. But that it not true. There are serious threats of you being failed when you put yourself on test. Here are the steps you must follow while learning Coding through Video Tutorials.


  1. Make up your mind that you have to do the coding shown in the video tutorial yourself and independently.
  2. Watch the video very slowly and carefully. Use pause and rewind wherever not clear.
  3. Use notepad to write some important lines.
  4. After completing 1 lesson, do not start the next one. STOP.. come on, don't be greedy..
  5. Do all the coding yourself that you just watched in the video. If needed, watch the portion of the video again.
  6. Once everything is clear from the lesson, move ahead with the next chapter and follow the steps again.

Hope this helps some of learners like me..keep learning...