Posts

Readable-stream

Streaming Consistency

Since Node's streaming Api is still changing and is in 'unstable' category, writing a npm module using streams may cause some unexpected behaviors on older versions of Node. To ensure that streams are compatible with older versions of Node, a drop-in replacement for stream is available called 'readable-stream'.

Categories: #JavaScript
Tags: #NodeJs
Streaming Lines

Line by Line

There are many streaming modules on npm to read lines from text files, but many are inaccurate and slow. Inaccurate means that there is a failure to read many lines and slow means that files with a lot of text per line will cause the modules to crawl.

Categories: #JavaScript
Tags: #NodeJs
Simple Server

No nodejs required

Many times there are code samples on Github that have simple static files that you would want to run on a server, such as the case if there are ajax calls in javascript files.

Categories: #Shell
Removing Stylesheet Rules

Off with the Rule

Most of the time, css rules are overridden to get a different style, but some rules need to be outright removed. For example, if a hover effect is in place when javascript is disabled, but the rule might interfere with the javascript code when javascript is enabled. This might happen when using a jQuery plugin for menu creation or text effect.

Categories: #JavaScript
jQuery Performance Tips #1

Checking Visibility

// Visibility Test Cases

$("#word").is(":visible");
$("#word:visible").length == 1;
$("#word:visible").length > 0;
$("#word").css("display") == "block";
$("#word").is(":not(:hidden)");
!$("#word").is(":hidden");
Categories: #JavaScript
Tags: #jQuery