Find valid letters in string of numbers

Here is an attempt to, given a string, determine how many valid numbers are contained. Numbers are restricted to the letters of the alphabet they map to.

Tree traversal examples

Attempts at finding a solution to tree scans for target elements:

Ember Addon Shim Maintenance

Bower Shim Maintenance

This is one example of making Ember add-on using a Bower shim maintenance workflow. A Bower shim is basically a wrapper for some arbitrary set of files you want to become available in bower_components in a client application's project folders.

Using the ember-cli generator, developers can now easily add Bower dependencies to Ember projects via a call to addBowerPackageToProject in an afterInstall hook. More on this later.

cURLing with Basic Authentication

Note to self, cURL with Basic Authentication:

curl -i --user [username]:[password] \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'X-Some-Header: SomeValue' \
    -X GET 'schema://domain/arg/value/arg/etc'

Short conversation with my build tool


$> make money

build tool:

make: *** No rule to make target `money'.  Stop.

... short but to the point.

"su - root" or "sudo" complains of incorrect password but normal root login works

If you are unable to sudo or su, there are a couple binaries that may need setuid as the root user. On Fedora, it may just be that the user you're trying to sudo/su with a user who is not in the wheel group (other distributions use the sudoers group instead of wheel).

If you're sure you user is in wheel, check permissions on the sudo and su binaries like this (you should logged in as root for doing so):


Vim Paste/NoPaste

To toggle "paste" mode for Vim, do this to enable ctrl-v with proper indentation.

:set paste

Remember to type the ":" initially to enter command mode. You are then saying "set paste".

When you're done, reset to non-paste mode:

:set nopaste


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