Check if UNIX Path has Hidden Directory or File

This snippet of code uses regular expression to test if a path string contains any hidden directory. The use-case was derived from the difficulty in determining whether directory is hidden or not using NodeJS path module. Owing to the possibility of their existence within a long path string, this function returns false if any directory or the terminal file of a path has a name that starts with a dot.

A relevant StackOverflow question is located at http://stackoverflow.com/questions/8905680/nodejs-check-for-hidden-files/ and a gist is at https://gist.github.com/shamasis/7704671

20131222-113745.jpg

Knight in Rusted Armour

Stands stooped the knight
Adorned by the faintness of darkness
Covered by the mist of silhouette
And the gleam of golden dust. 

The next daybreak stands far away
And what lies ahead is the deception of dawn
Shadows cast from the vantage of clouds
Revealing the scars of the untold wars. 

Riding upon the moonbeams of agony
His sword had bathed times to a halt
His eyes being the shining glory
Of dreams that are seldom bought

Through the forests he strode
His fears riding his feats of glory
His triumphs leading his way to ditches
With his legends of unwritten stories. 

Whenever he stopped and rested his body
Bereavement was bestowed upon his kins of spear
Where his mind would scamper off to fields
Where truth was but an ally of fear. 

There he stood, lifeless and in pain
His agonies chiseled on to the horse he rode
The armour dropped loose from its lock
Rusted not by age but by faintness of war.

Quick Validating JavaScript Function Before Call

There are many instances where we have to execute a function where we have no idea whether it actually exists or not. Let’s say for example, a function expects another function passed to it as parameter, which would later be executed as callback. A very common usage would be the callback function sent to AJAX requests.

Generally, we would code it with an if-block and check whether the variable (say, callback) is a function or not. If it is, we execute it when we have the work completed (say marked by a variable called workIsDone.)

Continue reading

Minor Bug Fix to jQuery Touch Drag Plugin

On 21st of June, the jQuery drag event plugin with iPhone (iOS) touch support was released. It has helped to add touch-based drag functionality to many existing web applications using the jQuery drag plugin. A minor update is released for this plugin that fixes the possibility of lack of touch-drag functionality on certain touch devices.

Continue reading