How to flush DNS cache on Mac OS 10.5,6

Sometimes adding a new subdomain to a known host for development means waiting for your local DNS cache to clear before your computer will be able to load the new subdomain's content into a browser. This may have to do with the fact that your local DNS caches entries only allows entries to update once they expire. You may not wish to wait around for that.

To force your local machine's DNS cache to clear, do the following:


Node.js Promises using when/then

Doing tasks then doing other tasks... then doing other tasks... is a core problem solved by asynchronous programming. Node.js, in combination with some additional libraries, offers a vehicle for unhooking an application workflow from sequential processes. Here's a quick look at a script demonstrating the deferring of certain tasks until others have completed. In this example, the output in the console would be:

i said: bam

After one second "bam" is printed. Then another second later "i said: bam" is printed.

Node.js, Turn debugging on for specific modules

Sometimes when working on a Node.js app, it's helpful to turn debugging on for particular modules. To do so, you can simply set an environment variable NODE_DEBUG when you start your app to flag which modules should output their debug messages.

Here's how to enable debugging for, say, the http, cluster, and modules:

$> NODE_DEBUG={http,cluster,} node app


*nix find, exclude node_modules from list

Say you have some tests you want to run using make, and you want to find all the files in your project with .test.js in as the extension. This is typical of a Node/Express application. However, everything in node_modules ships with its own tests (or should do so :), and you probably don't want the overhead of running those tests as well. Unix find supports a number of helpful operations to let you surgically produce a list of test files to run.

Here's a quick way of getting the list without using grep (which could cause you to relinquish access to find's other operations):



Etiology is the study of causation, or origination.

-- cf Wikipedia:



In logic, a tautology is a formula which is true in every possible interpretation. A formula is satisfiable if it is true under at least one interpretation, and thus a tautology is a formula whose negation is unsatisfiable. Unsatisfiable statements, both through negation and affirmation, are known formally as contradictions. A formula that is neither a tautology nor a contradiction is said to be logically contingent. Such a formula can be made either true or false based on the values assigned to its propositional variables.



Ontology is the philosophical study of the nature of being, existence, or reality, as well as the basic categories of being and their relations. Traditionally listed as a part of the major branch of philosophy known as metaphysics, ontology deals with questions concerning what entities exist or can be said to exist, and how such entities can be grouped, related within a hierarchy, and subdivided according to similarities and differences.

-- cf Wikipedia:


Commenting multiple lines in vim

to comment multiple lines in vim editor without using a plugin, try:

  • ctrl+v (block-visual selection mode)
  • select the first character of the lines with arrow keys
  • shift+i (insert mode)
    *type the comment marker: #
  • esc

... and wait. Takes a second or two for the characters to paint in.


Best Game Ever!

Check out this amazing implementation of pure JavaScript Pac-Man.

Or browse code on Github.

Open and write to system file in Perl

use Data::Dumper;
open (TMP, '>> [path_to_file]');
print TMP Dumper( [info_you_want_to_write] );
close TMP;