File permissions mode 0777 vs 777

If the question Whats the difference between 0777 vs 777 file modes? runs through your mind, you’re not alone. Lets find out… A bit of history, I needed to create a directory (using Php). So as per the syntax of mkdir(), I used mkdir(‘/path/to/create/dir’, 777); where the 2nd passed parameter is the file mode. Normally, this should have worked fine and uploading any file to this folder should have worked …read more

How to recover from a Frozen MAC ?

Mac OS is usually quite stable and not prone to a system crash, yet seldom it does get stuck/frozen. Lets check out what can you do to recover from your frozen MAC without having to electrically reboot. Force Quit an application In the Dock, right click the offending application and select quit. If that doesn’t work, Ctrl + click the offending App, and then Hold Option That should turn the …read more

Exclamation mark before a function aka IIFE

Immediately-Invoked Function Expression (IIFE) If you ever happen to look at any of code generated using build tools like Webpack or any other Minification/Uglification tool, you may have encountered an exclamation mark before a function only to wonder what it exactly does ? Well, in short, that exclamation mark converts the function into an Immediately-Invoked Function Expression (IIFE). Now what exactly is an IIFE ? As the full-form indicates, it …read more

Whats a Double arrow in javascript

What do the operators “>>” (double arrow) and “|” (single pipe) mean in JavaScript? If that’s the question that runs through your mind, then you are at the right place to discover Bitwise operators. 1. The Right Shift Operator >>(double arrow) Shifts x in binary representation y (< 32) bits to the right, discarding bits shifted off. Or more simply x >> y means to shift the bits of x …read more

JS File Upload with Dropzone and Symfony

Handling File Uploads completely server-side (especially with Symfony) doesn’t usually seem a pretty straightforward task. It requires a lot of tweaking for stuff as simple as displaying the upload progress or even generate thumbnails for images, etc. Besides, the documentation is pretty convoluted in itself. An alternate is to use the simplicity of JS File Upload with Dropzone and Symfony 3.x+ that’ll not only help fast-track development but also avoid …read more

Get Random rows in Doctrine

Every Php Symfony developer knows the struggle of getting random rows/records via Doctrine. This is because there is no native solution present and quite unfortunately, the doctrine team isn’t even willing to implement this feature! (Reference) So how could we get random rows/objects? Lets go over the possible options, each having its advantages & disadvantages : 1. Add a customized Numeric Function: To do this, define a new class in …read more

What to do when Ubuntu Freezes/Crashes?

All operating systems freeze sometimes, and Ubuntu is no exception. It so happens that when Ubuntu Freezes, all you’re left with is a blank screen or a non-working mouse/keyboard or perhaps you have a particular program that has crashed/frozen. What could you do to debug and regain control before you decide to pull the plug and restart all over? Does a magic combination like Ctrl + Alt + Delete exist …read more

Demystifying Promises vs Callbacks

Aren’t Promises just regular Callbacks? What are the pros/cons of using one over the other? Promises vs Callbacks? Questions like these bothering you? Not anymore! Before we actually go dive in deeper, lets quickly remind ourselves the basic definitions of these terms and what they are meant to accomplish. Callbacks: A Callback is a any function which is passed as a parameter to another function and is invoked/executed only after …read more

Autocomplete using Live Templates

During development, isn’t it several 100 times that we need to print something on the screen? (Maybe just to check the flow of execution, especially with the advent of modular development?) Well, we end up typing the same syntax over and over again. Certainly we could do a copy-paste each time but even then you’d need to type the whole thing the first time at least! and the effort involved …read more

Setup Git prompt step by step

While using GIT, isn’t it pretty often that you need to keeping checking what branch you are currently on, or if there is stashed content or not, or if you are ahead/behind of the remote repository and so on ? How about we got this information without having to do a git status or a git stash show each time? Git Prompt to the Rescue! Git prompt helps save precious …read more