Author: hasin

Saving a HUGE bandwidth cost in WordPress by automatically serving media contents from copy.com

shutterstock_132384233
The title almost says it all. Our mission is to save the bandwidth cost (and ensure better deliverability) by leveraging the power of headless installation of copy.com client in Linux, and then integrating it into WordPress. The integration must work seamlessly so that the viewers don’t see a difference, and at the same time you don’t have to put any extra effort. Beside saving bandwidth, this also reduces extra load from your web server. There’s another surprise which I will tell you later. For now, keep reading 🙂

You need at least a VPS to make this setup working, preferably with root access. These days VPSes are cheap. You can purchase an 128MB VPS for ~14/yr from Ramnode (such a fantastic provider) or may be for ~19/yr from WeLoveServers. Or feel free to use your existing VPSes if you have one.

Step 1: Headless installation of copy.com app
You can use your existing copy.com or register a new one using my referral code http://copy.com?r=Tbcrni, you and I both will be getting an extra 5GB if you do so.

Now log into your linux box via SSH, you need to have root privilege to complete this step.
(more…)

āĻŦā§‹āϝāĻŧāĻžāϰ āύāĻŋāϝāĻŧ⧇ āĻ•āĻĨāĻžāĻŦāĻžāĻ°ā§āϤāĻž

bower

āĻŦā§‹āϝāĻŧāĻžāϰ (Bower) āĻšāϞ āĻĢā§āϰāĻ¨ā§āϟ āĻāĻ¨ā§āĻĄ āĻĄā§‡āϭ⧇āϞāĻĒāĻŽā§‡āĻ¨ā§āĻŸā§‡āϰ āϏāĻŽāϝāĻŧ āϝ⧇āϏāĻŦ āϜāĻžāĻ­āĻžāĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āĻĢāĻžāχāϞ āĻŦāĻž āϏāĻŋāĻāϏāĻāϏ āĻĢāĻžāχāϞ āϞāĻžāϗ⧇ āϏ⧇āϗ⧁āϞ⧋ āĻŽā§āϝāĻžāύ⧇āϜ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āϟ⧁āχāϟāĻžāϰ āϟāĻŋāĻŽā§‡āϰ āϤ⧈āϰ⧀ āĻ•āϰāĻž āĻāĻ•āϟāĻž āĻĒā§āϝāĻžāϕ⧇āϜ āĻŽā§āϝāĻžāύ⧇āϜāĻžāϰ āϟ⧁āϞāĨ¤ āĻŦā§‹āϝāĻŧāĻžāϰ āĻĻāĻŋāϝāĻŧ⧇ āϖ⧁āĻŦ āϏāĻšāĻœā§‡āχ āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ⧇āϰ āϜāĻ¨ā§āϝ āĻĒā§āϰāϝāĻŧā§‹āϜāύ⧀āϝāĻŧ āĻœā§‡āĻāϏ āĻŦāĻž āϏāĻŋāĻāϏāĻāϏ āĻĢāĻžāχāϞ āĻ…ā§āϝāĻžāĻĄ/āϰāĻŋāĻŽā§āĻ­ āĻ•āϰāĻž āϝāĻžāϝāĻŧ, āφāĻĒāĻ—ā§āϰ⧇āĻĄ āĻ•āϰāĻž āϝāĻžāϝāĻŧāĨ¤ āĻāχ āĻ•āĻžāĻœā§‡āϰ āϜāĻ¨ā§āϝ āϰāϝāĻŧ⧇āϛ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ⧇āϰ āĻŦāĻŋāĻļāĻžāϞ āĻĒā§āϝāĻžāϕ⧇āϜ āϰāĻŋāĻĒā§‹āϜāĻŋāϟāϰāĻŋ āϝ⧇āĻ–āĻžāύ⧇ āφāĻĒāύāĻŋ āĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āϏāĻžāĻ°ā§āϚ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŦ⧇āύ āϖ⧁āĻŦ āϏāĻšāĻœā§‡āχāĨ¤ āĻāχ āφāĻ°ā§āϟāĻŋāϕ⧇āϞ⧇ āφāĻŽāϰāĻž āĻĻ⧇āĻ–āĻŦ āĻ•āĻŋāĻ­āĻžāĻŦ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāϤ⧇ āĻšāϝāĻŧ 🙂

āĻŦā§‹āϝāĻŧāĻžāϰ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž
āĻŦā§‹āϝāĻŧāĻžāϰ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āφāĻŽāĻžāĻĻ⧇āϰ āĻ•āĻŽā§āĻĒāĻŋāωāϟāĻžāϰ⧇ āύ⧋āĻĄāĻœā§‡āĻāϏ āĻāĻŦāĻ‚ āĻāύāĻĒāĻŋāĻāĻŽ āϟ⧁āϞ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž āĻĨāĻžāĻ•āϤ⧇ āĻšāĻŦ⧇āĨ¤ āύ⧋āĻĄ āĻāĻŦāĻ‚ āĻāύāĻĒāĻŋāĻāĻŽ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āφāĻĒāύāĻžāϰāĻž http://nodejs.org/ āĻĨ⧇āϕ⧇ āχāύāĻ¸ā§āϟāϞāĻžāϰ āϟāĻŋ āĻĄāĻžāωāύāϞ⧋āĻĄ āĻ•āϰ⧇ āϚāĻžāϞāĻžāύ, āĻāĻ•āχāϏāĻžāĻĨ⧇ āύ⧋āĻĄ āĻāĻŦāĻ‚ āĻāύāĻĒāĻŋāĻāĻŽ āχāύāĻ¸ā§āϟāϞ āĻšāϝāĻŧ⧇ āϝāĻžāĻŦ⧇

āύ⧋āĻĄ āĻāĻŦāĻ‚ āĻāύāĻĒāĻŋāĻāĻŽ āĻ āĻŋāĻ• āĻŽāϤ āχāύāĻ¸ā§āϟāϞ āĻšāϝāĻŧ⧇āϛ⧇ āĻ•āĻŋāύāĻž āϏ⧇āϟāĻž āĻŦā§‹āĻāĻžāϰ āϜāĻ¨ā§āϝ āφāĻĒāύāĻžāϰ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āϞāĻžāχāύ/āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ āĻ“āĻĒ⧇āύ āĻ•āϰ⧇ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāύ node -v āĻāĻŦāĻ‚ npm –v āĨ¤ āĻāĻ•āϟ⧁ āϖ⧇āϝāĻŧāĻžāϞ āϰāĻžāĻ–āĻŦ⧇āύ āϝ⧇ āĻāĻ•āϟāĻŋāϤ⧇ -v āĻāĻŦāĻ‚ āφāϰ⧇āĻ•āϟāĻŋ āĻ•āĻŽāĻžāĻ¨ā§āĻĄā§‡ –v āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž āĻšāϝāĻŧ⧇āϛ⧇āĨ¤ āĨ¤ āϏāĻŦāĻ•āĻŋāϛ⧁ āĻ āĻŋāĻ•āĻ āĻžāĻ• āĻĨāĻžāĻ•āϞ⧇ āφāĻĒāύāĻžāϰāĻž āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ⧇ āύ⧋āĻĄ āĻāĻŦāĻ‚ āĻāύāĻĒāĻŋāĻāĻŽā§‡āϰ āĻ­āĻžāĻ°ā§āϏāύ āύāĻžāĻŽā§āĻŦāĻžāϰ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāϰāĻŦ⧇āύāĨ¤ āφāϰ āϕ⧋āύ āĻāϰāϰ āĻĒ⧇āϞ⧇ āφāĻŦāĻžāϰ āύ⧋āĻĄ āĻ…āĻĨāĻŦāĻž āĻāύāĻĒāĻŋāĻāĻŽ āχāύāĻ¸ā§āϟāϞ āĻ•āϰ⧁āύ āĻ…āĻĨāĻŦāĻž āĻ“āĻĻ⧇āϰ āϏāĻžāχāĻŸā§‡ āĻ—āĻŋāϝāĻŧ⧇ āĻŸā§āϰāĻžāĻŦāϞāĻļ⧁āϟāĻŋāĻ‚ āϏ⧇āĻ•āĻļāύ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāϰ⧇āύ

node-npm

āĻāĻŦāĻžāϰ āĻŦā§‹āϝāĻŧāĻžāϰ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻžāϰ āĻĒāĻžāϞāĻž, āφāϰ āϏ⧇āϟāĻž āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āφāĻĒāύāĻžāϰ āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ⧇ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāύ npm install -g bowerāĨ¤ āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ⧇āϰ āĻŽāĻ§ā§āϝ⧇āχ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāĻŦ⧇āύ āĻ•āύāϏ⧋āϞ⧇ āϞ⧇āĻ–āĻž āωāϠ⧇āϛ⧇ āϝ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ āχāύāĻ¸ā§āϟāϞ⧇āĻļāύ āϏāĻžāĻ•āϏ⧇āϏāĻĢ⧁āϞ āĻšāϝāĻŧ⧇āϛ⧇āĨ¤ āϏāĻšāϜ āύāĻž?

bower-install

āĻāĻŦāĻžāϰ āϚāϞ⧁āύ āĻĻ⧇āĻ–āĻŋ āĻ•āĻŋāĻ­āĻžāĻŦ⧇ āφāĻŽāϰāĻž āĻŦā§‹āϝāĻŧāĻžāϰ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻŦ

āĻŦā§‹āϝāĻŧāĻžāϰ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž
āĻĒā§āϰāĻĨāĻŽā§‡ āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ āĻ“āĻĒ⧇āύ āĻ•āϰ⧇ āφāĻĒāύāĻžāϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āĻĒā§āϰāĻŦ⧇āĻļ āĻ•āϰ⧁āύ, āĻ…āĻĨāĻŦāĻž āύāϤ⧁āύ āĻāĻ•āϟāĻŋ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āϤ⧈āϰ⧀ āĻ•āϰ⧇ āϏ⧇āĻ–āĻžāύ⧇ āĻĒā§āϰāĻŦ⧇āĻļ āĻ•āϰ⧁āύāĨ¤ āφāĻŽāϰāĻž āϧāϰ⧇ āύāĻŋāĻŦ āφāĻŽāĻžāĻĻ⧇āϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āĻŸā§‡āϰ āϜāĻ¨ā§āϝ āύāĻŋāĻšā§‡āϰ āϤāĻŋāύāϟāĻŋ āĻĢāĻžāχāϞ āϞāĻžāĻ—āĻŦ⧇

  • āĻœā§‡āϕ⧋āϝāĻŧ⧇āϰ⧀
  • āĻŽā§āϝāĻžāĻ—āύāĻŋāĻĢāĻŋāĻ• āĻĒāĻĒāφāĻĒ
  • āĻŦ⧁āϟāĻ¸ā§āĻŸā§āϰ‍ā§āϝāĻžāĻĒ āϏāĻŋāĻāϏāĻāϏ

āφāĻŽāϰāĻž āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ⧇ āĻāϏ⧇ āĻĒā§āϰāĻĨāĻŽā§‡ āĻœā§‡āϕ⧋āϝāĻŧ⧇āϰ⧀ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāĻŦ bower install jqueryāĨ¤ āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ⧇āϰ āĻŽāĻžāĻā§‡āχ āĻŦā§‹āϝāĻŧāĻžāϰ āφāĻĒāύāĻžāϕ⧇ āϜāĻžāύāĻŋāϝāĻŧ⧇ āĻĻ⧇āĻŦ⧇ āϝ⧇ āĻœā§‡āϕ⧋āϝāĻŧ⧇āϰ⧀ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž āϏāĻĢāϞ āĻšāϝāĻŧ⧇āϛ⧇āĨ¤ āφāĻĒāύāĻŋ āφāĻĒāύāĻžāϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āĻĻ⧇āĻ–āĻŦ⧇āύ bower_components āύāĻžāĻŽā§‡ āύāϤ⧁āύ āĻāĻ•āϟāĻŋ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āϤ⧈āϰ⧀ āĻšāϝāĻŧ⧇āϛ⧇, āϝāĻžāϰ āĻŽāĻžāĻā§‡ āĻœā§‡āϕ⧋āϝāĻŧ⧇āϰ⧀ āύāĻžāĻŽā§‡āϰ āĻāĻ•āϟāĻž āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ⧇ jquery.js āϰāϝāĻŧ⧇āϛ⧇āĨ¤

āĻāĻ›āĻžāĻĄāĻŧāĻžāĻ“ āφāĻĒāύāĻŋ bower list āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāϞ⧇ āĻĻ⧇āĻ–āĻŦ⧇āύ āĻŦā§‹āϝāĻŧāĻžāϰ āϖ⧁āĻŦ āϏ⧁āĻ¨ā§āĻĻāϰ āĻ•āϰ⧇ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž āĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āĻāĻŦāĻ‚ āϤāĻžāĻĻ⧇āϰ āĻ­āĻžāĻ°ā§āϏāύ āύāĻŽā§āĻŦāϰ āĻĻ⧇āĻ–āĻŋāϝāĻŧ⧇ āĻĻ⧇āĻŦ⧇āĨ¤

bower-jquery

āϖ⧇āϝāĻŧāĻžāϞ āĻ•āϰāϞ⧇ āĻĻ⧇āĻ–āĻŦ⧇āύ āϝ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ āĻĄāĻŋāĻĢāĻ˛ā§āϟ āĻ­āĻžāĻŦ⧇ āĻĒā§āϝāĻžāϕ⧇āĻœā§‡āϰ āĻŦāĻ°ā§āϤāĻŽāĻžāύ āĻ­āĻžāĻ°ā§āϏāύ āχāύāĻ¸ā§āϟāϞ āĻ•āϰ⧇āϛ⧇āĨ¤ āĻ•āĻŋāĻ¨ā§āϤ⧁ āφāĻĒāύāĻžāϰ āϝāĻĻāĻŋ āĻ…āĻ¨ā§āϝ āϕ⧋āύ āĻ­āĻžāĻ°ā§āϏāύ āĻĻāϰāĻ•āĻžāϰ āĻšāϝāĻŧ āϤāĻžāĻšāϞ⧇ āĻ•āĻŋ āĻ•āϰāĻŦ⧇āύ? āϧāϰ⧁āύ āφāĻĒāύ⧇āϰ āĻĻāϰāĻ•āĻžāϰ āĻœā§‡āϕ⧋āϝāĻŧ⧇āϰ⧀āϰ ā§§.ā§§ā§Ļ.⧍ āĻ­āĻžāĻ°ā§āϏāύāĨ¤ āĻŦā§‹āϝāĻŧāĻžāϰ⧇ āϝ⧇āϕ⧋āύ āĻĒā§āϝāĻžāϕ⧇āϜ āχāύāĻ¸ā§āϟāϞ āĻ•āϰ⧇ āĻĻ⧇āϝāĻŧāĻžāϰ āϏāĻŽāϝāĻŧ āϤāĻžāϰ āĻ­āĻžāĻ°ā§āϏāύ āύāĻŽā§āĻŦāϰāĻ“ āωāĻ˛ā§āϞ⧇āĻ– āĻ•āϰ⧇ āĻĻ⧇āϝāĻŧāĻž āϝāĻžāϝāĻŧāĨ¤ āϝ⧇āĻŽāύ āĻāχ āĻ•ā§āώ⧇āĻ¤ā§āϰ⧇ āφāĻŽāϰāĻž āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ⧇ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻ⧇āĻŦ bower install jquery#1.10.2, āϤāĻžāĻšāϞ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ āϤāĻžāϰ āχāĻ¨ā§āϟāĻžāϰāĻ…ā§āϝāĻžāĻ•āϟāĻŋāĻ­ āĻĒā§āϰāĻŽā§āĻĒāĻŸā§‡āϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ āĻ—āĻžāχāĻĄ āĻ•āϰāĻŦ⧇ ā§§.ā§§ā§Ļ.⧍ āĻ­āĻžāĻ°ā§āϏāύ āχāύāĻ¸ā§āϟāϞ āĻ•āϰ⧇ āύ⧇āϝāĻŧāĻžāϰ āϜāĻ¨ā§āϝāĨ¤ āύāĻŋāĻšā§‡āϰ āĻ¸ā§āĻ•ā§āϰāĻŋāύāĻļāϟāϟāĻŋ āĻĻ⧇āĻ–āϞ⧇ āĻāϟāĻž āφāϰāĻ“ āĻĒāϰāĻŋāĻˇā§āĻ•āĻžāϰ āĻšāϤ⧇ āĻĒāĻžāϰ⧇

bower-jquery-1.10.2

āĻŦā§‹āϝāĻŧāĻžāϰ⧇ āĻĒā§āϝāĻžāϕ⧇āϜ āϏāĻžāĻ°ā§āϚ āĻ•āϰāĻž
āϕ⧋āύ āĻĒā§āϝāĻžāϕ⧇āϜ āĻŦāĻž āĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āĻŦā§‹āϝāĻŧāĻžāϰ⧇āϰ āϰāĻŋāĻĒā§‹āϜāĻŋāϟāϰ⧀āϤ⧇ āφāϛ⧇ āĻ•āĻŋāύāĻž āϏ⧇āϟāĻž āϜāĻžāύāϤ⧇ āĻšāϞ⧇ bower search āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāϞ⧇āχ āĻŦā§‹āϝāĻŧāĻžāϰ āϏ⧇āχ āĻĒā§āϝāĻžāϕ⧇āĻœā§‡āϰ āĻŦāĻŋāώāϝāĻŧ⧇ āĻŦāĻŋāĻ¸ā§āϤāĻžāϰāĻŋāϤ āϤāĻĨā§āϝ āĻĻ⧇āĻ–āĻžāĻŦ⧇āĨ¤ āϝ⧇āĻŽāύ āφāĻŽāϰāĻž āϝāĻĻāĻŋ magnigic popup āϜāĻžāĻ­āĻžāĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āĻĒā§āϝāĻžāϕ⧇āϜ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻžāϰ āφāϗ⧇ āĻšā§‡āĻ• āĻ•āϰ⧇ āύāĻŋāϤ⧇ āϚāĻžāχ āϝ⧇ āĻāχ āύāĻžāĻŽā§‡ āφāϏāϞ⧇āχ āϕ⧋āύ āĻĒā§āϝāĻžāϕ⧇āϜ āφāϛ⧇ āĻ•āĻŋāύāĻž āϤāĻžāĻšāϞ⧇ āφāĻŽāϰāĻž āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ⧇ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāĻŦ bower search magnific

bower-magnific

āĻŦā§‹āϝāĻŧāĻžāϰ āĻĻ⧇āĻ–āĻžāĻšā§āϛ⧇ āϝ⧇ magnific-popup āύāĻžāĻŽā§‡ āĻāĻ•āϟāĻž āĻĒā§āϝāĻžāϕ⧇āϜ āφāϛ⧇āĨ¤ āϏ⧇āϟāĻž āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϤ⧇ āĻšāϞ⧇ āφāĻŽāϰāĻž āφāϗ⧇āϰ āĻŽāϤāχ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāĻŦ bower install magnific-popupāĨ¤ āĻ āĻŋāĻ• āĻŽāϤ āχāύāĻ¸ā§āϟāϞ āĻšāϝāĻŧ⧇āϛ⧇ āĻ•āĻŋāύāĻž āϏ⧇āϟāĻž āĻšā§‡āĻ• āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āφāĻŽāϰāĻž bower_components āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ⧇ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāϰāĻŋ āĻ…āĻĨāĻŦāĻž bower list āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāϝāĻŧ⧇ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāϰāĻŋ āĨ¤

āĻĒā§āϝāĻžāϕ⧇āϜ āφāύāχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž
āĻŦā§‹āϝāĻŧāĻžāϰ⧇āϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ āϕ⧋āύ āĻĒā§āϝāĻžāϕ⧇āϜ āφāύāχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž āϖ⧁āĻŦāχ āϏāĻšāϜāĨ¤ āĻļ⧁āϧ⧁ install āĻāϰ āĻŦāĻĻāϞ⧇ uninstall āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāύ, āĻŦā§āϝāĻžāϏ āĻšāϝāĻŧ⧇ āϗ⧇āϞāĨ¤

āĻĒā§āϝāĻžāϕ⧇āϜ āϞāĻŋāĻ¸ā§āϟ āϏāĻ‚āϰāĻ•ā§āώāύ āĻ•āϰāĻž
āĻāχāϝ⧇ āφāĻŽāϰāĻž āĻāχāϏāĻŦ āĻĒā§āϝāĻžāϕ⧇āϜ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϞāĻžāĻŽ, āĻāϗ⧁āϞ⧋ āφāĻŽāϰāĻž āĻāĻ•āϟāĻž āϞāĻŋāĻ¸ā§āϟ āĻšāĻŋāϏ⧇āĻŦ⧇ āϏāĻ‚āϰāĻ•ā§āώāύ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŋ āϝāĻžāϤ⧇ āĻĒāϰāĻŦāĻ°ā§āϤ⧀āϤ⧇ āφāĻĒāĻĄā§‡āϟ āĻ•āϰāϤ⧇ āĻšāϞ⧇ āĻŦāĻž āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϤ⧇ āĻšāϞ⧇ āĻāĻ• āĻāĻ• āĻ•āϰ⧇ āĻ•āϰāϤ⧇ āύāĻž āĻšāϝāĻŧāĨ¤ āĻāϜāĻ¨ā§āϝ āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ⧇āϰ āĻ•āĻžāϰ⧇āĻ¨ā§āϟ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ (āϝ⧇āĻ–āĻžāύ āĻĨ⧇āϕ⧇ āφāĻŽāϰāĻž bower āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āϚāĻžāϞāĻžāĻŦ) āĻāĻ•āϟāĻŋ āĻĢāĻžāχāϞ āϤ⧈āϰ⧀ āĻ•āϰāĻŋ bower.json āύāĻžāĻŽā§‡āĨ¤ āϝ⧇āϕ⧋āύ āĻŸā§‡āĻ•ā§āϏāϟ āĻāĻĄāĻŋāϟāϰ āĻĻāĻŋāϝāĻŧ⧇ āĻāχ āĻĢāĻžāχāϞ āĻāĻĄāĻŋāϟ āĻ•āϰāĻž āϝāĻžāĻŦ⧇ (āϤāĻŦ⧇ āĻ“āϝāĻŧāĻžāĻ°ā§āĻĄ āĻĒā§āϰāϏ⧇āϏāϰ āĻĻāĻŋāϝāĻŧ⧇ āύāϝāĻŧ)āĨ¤ āϝ⧇āĻŽāύ āφāĻŽāĻžāĻĻ⧇āϰ āφāϜāϕ⧇āϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āĻŸā§‡āϰ āϜāĻ¨ā§āϝ āφāĻŽāϰāĻž āύāĻŋāĻšā§‡āϰ āĻŽāϤ āĻ•āϰ⧇ bower.json āĻĢāĻžāχāϞ āϞāĻŋāĻ–āĻŦ, āϝ⧇āĻ–āĻžāύ⧇ dependencies āϏ⧇āĻ•āĻļāύ⧇ āφāĻŽāĻžāĻĻ⧇āϰ āϝāĻžāĻŦāϤ⧀āϝāĻŧ āĻĒā§āϝāĻžāϕ⧇āĻœā§‡āϰ āϞāĻŋāĻ¸ā§āϟ āϞāĻŋāϖ⧇ āϰāĻžāĻ–āĻž āĻšāĻŦ⧇
bower-json

āĻŦā§‹āĻāĻžāϰ āϏ⧁āĻŦāĻŋāϧāĻžāĻ°ā§āĻĨ⧇ āφāĻŽāĻŋ āĻāĻ–āĻžāύ⧇ āφāĻŦāĻžāϰ āϞāĻŋāϖ⧇ āĻĻāĻŋāϞāĻžāĻŽ
[sourcecode language=”javascript”]
{
"name": "Bower Article",
"version": "1.0.0",
"dependencies": {
"jquery":null,
"magnific-popup":null
}
}
[/sourcecode]

āĻāϰāĻĒāϰ āĻĨ⧇āϕ⧇ āφāĻŽāϰāĻž āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āĻāχ bower.json āĻĢāĻžāχāϞ āĻ•āĻĒāĻŋ āĻ•āϰ⧇ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāĻŦ bower installāĨ¤ āĻŦā§āϝāĻžāϏ āϤāĻžāĻšāϞ⧇āχ āĻŦā§‹āϝāĻŧāĻžāϰ āĻāχ bower.json āĻĢāĻžāχāϞ āĻĨ⧇āϕ⧇ āĻĄāĻŋāĻĒ⧇āĻ¨ā§āĻĄā§‡āĻ¨ā§āϏ⧀ āϞāĻŋāĻ¸ā§āϟ āĻĒāϰ⧇ āĻāĻ• āĻāĻ• āĻ•āϰ⧇ āϏ⧇āϗ⧁āϞ⧋ āχāύāĻ¸ā§āϟāϞ āĻ•āϰ⧇ āĻĢ⧇āϞāĻŦ⧇

āφāĻŽāϰāĻž āϝāĻĻāĻŋ āϕ⧋āύ āĻĒā§āϝāĻžāϕ⧇āĻœā§‡āϰ āϕ⧋āύ āĻĒāĻžāĻ°ā§āϟāĻŋāϕ⧁āϞāĻžāϰ āĻ­āĻžāĻ°ā§āϏāύ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϤ⧇ āϚāĻžāχ āϤāĻžāĻšāϞ⧇ null āĻāϰ āĻŦāĻĻāϞ⧇ āϏ⧇āχ āĻ­āĻžāĻ°ā§āϏāύ āύāĻŽā§āĻŦāϰ āϞāĻŋāϖ⧇ āĻĻāĻŋāĻŦ, āφāϰ āϞ⧇āĻŸā§‡āĻ¸ā§āϟ āĻ­āĻžāĻ°ā§āϏāύ āϚāĻžāχāϞ⧇ null āϞāĻŋāĻ–āĻŦāĨ¤ āϝ⧇āĻŽāύ āϝāĻĻāĻŋ āφāĻŽāϰāĻž āĻœā§‡āϕ⧋āϝāĻŧ⧇āϰ⧀āϰ ā§§.ā§§ā§Ļ.ā§§ āĻ­āĻžāĻ°ā§āϏāύ āϚāĻžāχ āϤāĻžāĻšāϞ⧇ āφāĻŽāĻžāĻĻ⧇āϰ bower.json āĻĢāĻžāχāϞ āĻšāĻŦ⧇ āύāĻŋāĻšā§‡āϰ āĻŽāϤ

[sourcecode language=”javascript”]
{
"name": "Bower Article",
"version": "1.0.0",
"dependencies": {
"jquery":"1.10.1",
"magnific-popup":null
}
}
[/sourcecode]
āĻāϰāĻĒāϰ āφāĻŽāϰāĻž āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāĻŦ bower install, āĻŦā§āϝāĻžāϏ!

āĻĒā§āϝāĻžāϕ⧇āϜ āϞāĻŋāĻ¸ā§āĻŸā§‡ āύāϤ⧁āύ āĻĒā§āϝāĻžāϕ⧇āϜ āĻŦāĻž āĻĄāĻŋāĻĒ⧇āĻ¨ā§āĻĄā§‡āĻ¨ā§āϏ⧀ āϝ⧋āĻ— āĻ•āϰāĻž
āφāĻŽāϰāĻž āϤ⧋ āχāϤ⧋āĻŽāĻ§ā§āϝ⧇āχ bower.json āĻĢāĻžāχāϞ⧇ āĻĻ⧁āχāϟāĻŋ āĻĒā§āϝāĻžāϕ⧇āϜ āϝ⧋āĻ— āĻ•āϰ⧇āĻ›āĻŋāĨ¤ āĻāĻ–āύ āφāĻŽāϰāĻž āϚāĻžāχ āύāϤ⧁āύ āĻāĻ•āϟāĻŋ āĻĒā§āϝāĻžāϕ⧇āϜ bootstrap āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϤ⧇āĨ¤ āϏ⧇āĻ•ā§āώ⧇āĻ¤ā§āϰ⧇ āφāĻŽāϰāĻž āĻĻ⧁āχ āĻ­āĻžāĻŦ⧇ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŋ

ā§§. āφāĻŽāϰāĻž āĻŽā§āϝāĻžāύ⧁āϝāĻŧāĻžāϞ⧀ bower.json āĻĢāĻžāχāϞ āĻāĻĄāĻŋāϟ āĻ•āϰ⧇ bootstrap āϕ⧇ āĻāĻ•āϟāĻž āύāϤ⧁āύ āĻĄāĻŋāĻĒ⧇āĻ¨ā§āĻĄā§‡āĻ¨ā§āϏ⧀ āĻšāĻŋāϏ⧇āĻŦ⧇ āϝ⧋āĻ— āĻ•āϰ⧇, āϏ⧇āχ bower.json āĻĢāĻžāχāϞ āϏ⧇āĻ­ āĻ•āϰ⧇ āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ⧇ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāϤ⧇ āĻĒāĻžāϰāĻŋ bower installāĨ¤ āφāĻŽāϰāĻž āĻĻ⧇āĻ–āĻŦ āϝ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ āĻ¸ā§āĻŦāϝāĻŧāĻ‚āĻ•ā§āϰ⧀āϝāĻŧ āĻ­āĻžāĻŦ⧇ bootstrap āχāύāĻ¸ā§āϟāϞ āĻ•āϰ⧇ āĻĢ⧇āϞāϛ⧇

āĻ…āĻĨāĻŦāĻž

⧍. āφāĻŽāϰāĻž bower.json āĻĢāĻžāχāϞ āĻŽā§āϝāĻžāύ⧁āϝāĻŧāĻžāϞ⧀ āĻāĻĄāĻŋāϟ āύāĻž āĻ•āϰ⧇ āĻŦāϰāĻ‚ āϟāĻžāĻ°ā§āĻŽāĻŋāύāĻžāϞ⧇ āϏāϰāĻžāϏāϰāĻŋ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāϤ⧇ āĻĒāĻžāϰāĻŋ bower install bootstrap -save āĨ¤ āϖ⧇āϝāĻŧāĻžāϞ āĻ•āϰ⧁āύ āĻāĻ–āĻžāύ⧇ āĻāĻ•āϟāĻž āĻ…āϤāĻŋāϰāĻŋāĻ•ā§āϤ āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāϟāĻžāϰ/āĻ¸ā§āϝ⧁āχāϚ āϝ⧋āĻ— āĻ•āϰāĻž āĻšāϝāĻŧ⧇āϛ⧇ -save āύāĻžāĻŽā§‡āĨ¤ āĻāϰ āĻĢāϞ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ āĻĻ⧁āχāϟāĻŋ āĻ•āĻžāϜ āĻ•āϰāĻŦ⧇āĨ¤ āĻĒā§āϰāĻĨāĻŽāϤ āĻŦā§‹āϝāĻŧāĻžāϰ bootstrap āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻŦ⧇, āĻĻā§āĻŦāĻŋāϤ⧀āϝāĻŧāϤ āĻŦā§‹āϝāĻŧāĻžāϰ āύāĻŋāĻœā§‡āχ bower.json āĻĢāĻžāχāϞ āĻāĻĄāĻŋāϟ āĻ•āϰ⧇ bootstrap āϕ⧇ āĻĄāĻŋāĻĒ⧇āĻ¨ā§āĻĄā§‡āĻ¨ā§āϏ⧀ āϏ⧇āĻ•ā§āĻļāύ⧇ āϝ⧋āĻ— āĻ•āϰ⧇ āĻĢ⧇āϞāĻŦ⧇āĨ¤ āφāĻŽāϰāĻž bower install bootstrap -save āĻāχ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻ⧇āϝāĻŧāĻžāϰ āĻĒāϰ bower.json āĻĢāĻžāχāϞ āĻšā§‡āĻ• āĻ•āϰāϞ⧇ āĻĻ⧇āĻ–āĻŦ āĻāϟāĻž āύāĻŋāĻšā§‡āϰ āĻŽāϤ āĻ•āύāĻŸā§‡āĻ¨ā§āϟ āĻĻ⧇āĻ–āĻžāĻšā§āϛ⧇ 🙂

bower-auto-update

āĻŦā§‹āϝāĻŧāĻžāϰ āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ āύāĻŋāĻœā§‡āϰ āĻĒāĻ›āĻ¨ā§āĻĻāĻŽāϤ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž
āφāĻŽāϰāĻž āĻāϤāĻ•ā§āώāύ āĻĻ⧇āϖ⧇āĻ›āĻŋ āϝ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ āĻĄāĻŋāĻĢāĻ˛ā§āϟāĻ­āĻžāĻŦ⧇ bower_components āύāĻžāĻŽā§‡āϰ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āϏāĻŦ āĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϛ⧇āĨ¤ āĻ•āĻŋāĻ¨ā§āϤ⧁ āφāĻŽāϰāĻž āϝāĻĻāĻŋ āϚāĻžāχ āϝ⧇ āφāĻŽāĻžāĻĻ⧇āϰ āϏāĻŦ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž āĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āϗ⧁āϞ⧋ bower_components āĻāϰ āĻŦāĻĻāϞ⧇ “scripts/vendor” āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āχāύāĻ¸ā§āϟāϞ āĻšāĻŦ⧇, āϤāĻžāĻšāϞ⧇ āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āύāĻŋāĻšā§‡āϰ āĻŽāϤ āĻ•āϰ⧇ .bowerrc āĻĢāĻžāχāϞ āϤ⧈āϰ⧀ āĻ•āϰ⧁āύ (āϖ⧇āϝāĻŧāĻžāϞ āϰāĻžāĻ–āĻŦ⧇āύ āύāĻžāĻŽā§‡āϰ āĻļ⧁āϰ⧁āϤ⧇ āĻāĻ•āϟāĻŋ . āϰāϝāĻŧ⧇āϛ⧇)āĨ¤ āϏ⧇āχ .bowerrc āĻĢāĻžāχāϞ⧇ āύāĻŋāĻšā§‡āϰ āĻŽāϤ āĻ•āϰ⧇ āύāĻŋāĻœā§‡āϰ āĻĒāĻ›āĻ¨ā§āĻĻ⧇āϰ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀ āωāĻ˛ā§āϞ⧇āĻ– āĻ•āϰ⧇ āĻĻāĻŋāύ
[sourcecode language=”javascript”]
{
"directory":"scripts/vendor/"
}
[/sourcecode]
āĻāϰāĻĒāϰ āφāĻŽāϰāĻž āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāĻŦ bower install, āĻŦā§āϝāĻžāϏ! āĻŦā§‹āϝāĻŧāĻžāϰ āύāĻŋāĻœā§‡āχ scripts/vendor āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āϤ⧈āϰ⧀ (āφāϗ⧇ āĻĨ⧇āϕ⧇ āϤ⧈āϰ⧀ āĻ•āϰāĻž āύāĻž āĻĨāĻžāĻ•āϞ⧇) āĻ•āϰ⧇ āϤāĻžāϰ āϭ⧇āϤāϰ⧇ āϏāĻŦ āĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āχāύāĻ¸ā§āϟāϞ āĻ•āϰ⧇ āĻĢ⧇āϞāĻŦ⧇

āωāĻĒāϏāĻ‚āĻšāĻžāϰ
āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ⧇ āĻ¸ā§āĻŽāĻžāĻ°ā§āϟ āĻ­āĻžāĻŦ⧇ āĻĒā§āϝāĻžāϕ⧇āϜ āĻŽā§āϝāĻžāύ⧇āϜ āĻ•āϰāϤ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ⧇āϰ āϜ⧁āĻĄāĻŧāĻŋ āύ⧇āχāĨ¤ āϏāĻŽāϝāĻŧ āĻŦāĻžāρāϚāĻžāύ⧋āϰ āϜāĻ¨ā§āϝ āĻāχāϏāĻŦ āϟ⧁āϞ āϤ⧈āϰ⧀ āĻšāĻšā§āϛ⧇ āĻĻāĻŋāύ āϕ⧇ āĻĻāĻŋāύ, āĻāĻŦāĻ‚ āĻ¸ā§āĻŽāĻžāĻ°ā§āϟ āĻĄā§‡āϭ⧇āϞāĻĒāĻžāϰāϰāĻž āϏ⧇āϗ⧁āϞ⧋ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰ⧇ āύāĻŋāĻœā§‡āĻĻ⧇āϰ āϏāĻŽāϝāĻŧ āϝ⧇āĻŽāύ āĻŦāĻžāρāϚāĻžāĻšā§āϛ⧇ āĻĒāĻžāĻļāĻžāĻĒāĻžāĻļāĻŋ āϤāĻžāĻĻ⧇āϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻŽā§āϝāĻžāύ⧇āϜāĻŽā§‡āĻ¨ā§āϟ āĻ•āϰāϛ⧇ āĻ…āĻ¤ā§āϝāĻ¨ā§āϤ āϏāĻšāϜāĻ­āĻžāĻŦ⧇āĨ¤ āφāϗ⧇ āĻŦā§‹āϝāĻŧāĻžāϰ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰ⧇ āύāĻž āĻĨāĻžāĻ•āϞ⧇ āφāϜāϕ⧇ āĻĨ⧇āϕ⧇āχ āĻļ⧁āϰ⧁ āĻ•āϰ⧇ āĻĻāĻŋāύ 🙂

āĻāϰ āĻĒāϰ⧇āϰ āφāĻ°ā§āϟāĻŋāϕ⧇āϞ⧇ āφāĻŽāϰāĻž āĻĻ⧇āĻ–āĻŦ āĻ•āĻŋāĻ­āĻžāĻŦ⧇ āφāĻŽāϰāĻž āϰāĻŋāϕ⧋āϝāĻŧāĻžāϰāĻœā§‡āĻāϏ (ReuireJS) āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰ⧇ āφāĻŽāĻžāĻĻ⧇āϰ āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ⧇ āĻ¸ā§āĻŦāϝāĻŧāĻ‚āĻ•ā§āϰ⧀āϝāĻŧāĻ­āĻžāĻŦ⧇ āφāĻŽāĻžāĻĻ⧇āϰ āϜāĻžāĻ­āĻžāĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āĻĢāĻžāχāϞ āϞ⧋āĻĄ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŋ, āĻāĻŦāĻ‚ āϏ⧇āĻ–āύ⧇āĻ“ āĻŦā§‹āϝāĻŧāĻžāϰ āφāĻŽāĻžāĻĻ⧇āϰ āĻ•āĻŋāĻ­āĻžāĻŦ⧇ āϏāĻžāĻšāĻžāĻ¯ā§āϝ āĻ•āϰ⧇āĨ¤

āĻāχ āϏāĻŋāϰāĻŋāĻœā§‡āϰ āϏāĻŦ āĻļ⧇āώ⧇āϰ āφāĻ°ā§āϟāĻŋāϕ⧇āϞ⧇ āφāĻŽāϰāĻž āĻĻ⧇āĻ–āĻŦ āϟāĻžāĻ¸ā§āĻ• āĻŽā§āϝāĻžāύ⧇āϜāĻžāϰ āĻ—ā§āϰāĻžāĻ¨ā§āĻŸā§‡āϰ (Grunt) āĻŦā§āϝāĻŦāĻšāĻžāϰ āϝāĻžāϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ āφāĻŽāϰāĻž āφāĻŽāĻžāĻĻ⧇āϰ āĻ…ā§āϝāĻžāĻĒā§āϞāĻŋāϕ⧇āĻļāύ⧇āϰ āϝāĻžāĻŦāϤ⧀āϝāĻŧ āĻ•āĻžāϜ āĻ…āĻŸā§‹āĻŽā§‡āϟ āĻ•āϰ⧇ āφāϰāĻ“ āĻ¸ā§āĻŽāĻžāĻ°ā§āϟāĻ­āĻžāĻŦ⧇ āĻĄā§‡āϭ⧇āϞāĻĒ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŦāĨ¤

Breakpoint JS – load external javascript for different browser breakpoints

idea

Live Demo: http://hasinhayder.github.io/BreakPoint/

Breakpoint helps you to define multiple breakpoint ranges and load external javascript files when someone resize their browser window to those breakpoints. Beside loading external scripts, Breakpoint also triggers an event whenever browser width falls in any of those predefined breakpoint ranges.

Using Breakpoint
Using BreakPoint is pretty simple. Include jQuery in your web application and then include jquery.breakpoint.js. Now you can define multiple breakpoint ranges and initialize like this

[sourcecode language=”javascript”]
$(document).ready(function(){
$.BreakPoint({
breakpoints:{
mobile:{max:480,load:true},
default:{min:480,max:1024, load:true},
wide:{min:1024,max:1200,load:true},
superwide:{min:1200,load:true},
}
});
});
[/sourcecode]

In the example above, we have defined four different breakpoints. The first one mobile will be used whenever browser is resized from 0px to 480 pixel (all inclusive). The next breakpoint, default will be used whenever browser is resized between 480px to 1024px (all inclusive), and so on.

Now, whenever a breakpoint is reached, BreakPoint jQuery Plugin will load an external javascript file with the same name of the breakpoint. For example, when browser is resized to 400px it will fall under mobile and now an external file named mobile.js will be loaded and executed.

By default BreakPoint will look for external javascript files in the js/ folder in the current path. But you can change this by passing a parameter named prefix, like this

[sourcecode language=”javascript”]
$(document).ready(function(){
$.BreakPoint({
prefix:"scripts/",
breakpoints:{
mobile:{max:480,load:true},
default:{min:480,max:1024, load:true},
wide:{min:1024,max:1200,load:true},
superwide:{min:1200,load:true},
}
});
});
[/sourcecode]

Now BreakPoint will load external js files from the scripts/ folder.

Breakpoint Parameters
prefix: By default, prefix is set to js/ but you can change it to anything you want.
breakpoints: for each breakpoints, there are three paramaters you can pass which are “min”, “max” and “load”. By default min is set to 0, max is set to 9999 and load is set to false. The load parameter is an important one if you want to load external javascript files whenever a breakpoint is reached. If load is set to true, external files will be loaded, otherwise not.

BreakPoint Events
Whenever a breakpoint is reached, BreakPoint plugin will trigger a window event named breakpoint. The event object will have an attribute named breakpoint which will contain the name of the breakpoint that has been reached. Here is an example how you can add an event listener to this breakpoint event

[sourcecode language=”javascript”]
$(document).ready(function(){
$(window).bind("breakpoint",function(e){
if(console)
console.log(e.breakpoint);
});
});
[/sourcecode]

That’s mainly it. Enjoy! Check out the live demo at http://hasinhayder.github.io/BreakPoint/

The Badass List of Essential jQuery Plugins

banner

Check it out here: http://hasinhayder.github.io/essential-jquery-plugins/

I have started curating this list for last couple of weeks and the purpose is to create an one stop place where you can look for the essential jQuery plugin for your project and look no where else. Honestly, sometime it’s really hard to find the perfect plugin in this overwhelming world of jQuery plugins.

I hope you will find it useful. If you want to contribute, you can open an issue and tell me a missing plugin and I will be happy enough to look at it. If it’s worth to be in the list, it will be added back there, no worry. You can also fork this github repo and add the missing plugin in the readme.md file in markdown format and send me a pull request.

So enjoy this badass list of essential jQuery Plugins which is continuously growing.

An Animated Responsive grid with Filtering feature

This is a followup of my previous post, where we had created a beautiful responsive grid with barely 6 lines of javascript code. But this time, we have added filtering feature in it, and added category/tag selector which triggers the filtering. For filtering we have used MixItUp library in this example.

Have a look at the live demo at http://hasinhayder.github.io/ResponsiveGalleryWithFiltering. Resize the browser window and see how the grid items adapt to the new width. Select categories from the dropdown list in the top right corner to see how the filtering works.

Positioning the dropdown list was managed using media queries which you can see at the bottom of the <style> block.

One more thing to note here, a very important note perhaps. If you have used MixItUp before then you probably already know that every time mixitup refreshes the list, it actually removes the old list items and redraws them in the container. This phenomenon removes any events attached to the list items. To fix it up, you need to attach event listeners using $.delegate() method, as done in the example. However, lets have a look at that

[sourcecode language=”javascript”]
$(".grid ul").delegate("li","click",function(){
var src = $(this).find("img").attr("src");
alert(src);
});
[/sourcecode]

Enjoy!

Detecting if a DOM element has visible scrollbar.

Webkit browsers, specially in Mac osx hides the scrollbar intelligently when not in use. This feature improves the look-n-feel. But for the designers, sometime this can be a pain because they may need to alter the designs based on the visibility of scrollbar.

Here goes two simple jQuery plugin which can detect the visibility of scrollbar for a given DOM element

For Horizontal Scrollbar
[sourcecode language=”javascript”]
(function($) {
$.fn.hasHorizontalScrollBar = function() {
return this.get(0) ? this.get(0).scrollWidth > this.innerWidth() : false;
}
})(jQuery);
[/sourcecode]

For Vertical Scrollbar
[sourcecode language=”javascript”]
(function($) {
$.fn.hasVerticalScrollBar = function() {
return this.get(0) ? this.get(0).scrollHeight > this.innerheight() : false;
}
})(jQuery);
[/sourcecode]

You can later use it like this
[sourcecode language=”javascript”]
if($("#element").hasVerticalScrollbar()){
//do whatever you’d like to
}
[/sourcecode]

Source & Idea: This SO Discussion 🙂

LazyMouse jQuery Plugin – detect mouse inactivity easily :)

LazyMouse

Before jumping into the details, let me hear you asking “WHY?”. To be honest, not all of you will need to detect the mouse inactivity in your web applications. But sometime, it’s useful to do something different after a certain period of inactivity either to grab attention of the viewer, or to help him by improving the UX. For example, hide the sidebar and top navigation when user is reading the content, to emphasis his reading experience. Or show an animation – just do whatever during your user’s mouse is inactive for some time.

And to detect mouse inactivity easily, here comes the LazyMouse jQuery plugin which attaches two new events to the bodyelement, one is mouse.active and another one is mouse.inactive . You can just add two listeners for those events and do whatever you want to do 🙂

Using jQuery LazyMouse is pretty simple. Initialize it like this
[sourcecode language=”javascript”]
$(document).ready(function(){
$.LazyMouse();
})
[/sourcecode]

You can also specify the inactivity threshold in milliseconds, like this

[sourcecode language=”javascript”]
$(document).ready(function(){
$.LazyMouse({
delay:2000 //2 seconds threshold
});
})
[/sourcecode]

Once initialized, as we have mentioned earlier, the body element will be triggered with two new events. Lets add a listener to those, like this

[sourcecode language=”javascript”]
$(document).ready(function(){
$("body").bind("mouse.active",function(){
console.log("Mouse Active");
});
$("body").bind("mouse.inactive",function(){
console.log("Mouse Inctive");
});
})
[/sourcecode]

The events are propagated using jQuery Debounce, and therefore it is rate limited for good. See the live demo at http://hasinhayder.github.io/LazyMouse, and fork the github repo at http://github.com/hasinhayder/LazyMouse

Enjoy 🙂

An awesome animated responsive grid in a few lines of javascript and css3 goodness

Screen Shot 2013-08-15 at 4.36.33 AM

Responsive grid is a pain to many people, because sometime they have to achieve the desired effects either using complex plugins, css layout styling with the help of media queries. And here comes a nifty solution which works perfectly well in all devices. The responsiveness is done using a few lines of Javascript which listens to window resize event. But to save the browser from refreshing the layout, it uses debounce technique which only fires after the resizing is done.

The trick is pretty neat. All you got to do is tell it a minimum width of the grid items. Then, once resized, it divides the window width by that minimum, extract the integer part and displays that many items in a row by setting a width (in percentage) for each of them.

[sourcecode language=”javascript”]
var minWidth = 250;
$(document).ready(function(){
$(window).resize($.debounce(250,function(){
var w = $(window).width();
var numberOfItems = parseInt(w/minWidth);
var itemWidthinPercentage = 100/numberOfItems;
$(".grid ul li").css({width:itemWidthinPercentage+"%"});
}));
});
[/sourcecode]

See the working grid at http://hasinhayder.github.io/responsivegrid and resize the window to check out how it fits perfectly.

The animation is done using the following css3 transition for each list item
[sourcecode language=”css”]
-webkit-transition:all 0.2s ease;
-moz-transition:all 0.2s ease;
-o-transition:all 0.2s ease;
-ms-transition:all 0.2s ease;
transition:all 0.2s ease;
[/sourcecode]

Checkout the demo and fork the github repo to customize it anyway you’d like to 🙂

CSS3 Storyline Animation using jQuery Transit Library

I have been learning CSS3 animations and transitions for last few days, and I found this awesome jQuery library “Transit” which can be used to replace CSS3 @KeyFrame animations. I am not a big fan of KeyFrame animations because it’s tough to write and you need to calculate a lot of things and express them in percentage of total time. Which makes it even harder to write. I mean for something small, it is more than awesome – but as soon you start writing something big, where each elements are chained to each other, you will find it pretty tough.

So, here goes the CSS3 Storyline Animation using jQuery Transit library. There are many sliders in the market who uses animations like this – so if you are good, you can even make a animation designer app using Transit.

Screen Shot 2013-07-23 at 9.01.23 PM

Github URL: https://github.com/hasinhayder/CSS3-Storyline-Animation

Live Demo: http://bit.ly/CSS3Storyline