Skip to content

Instantly share code, notes, and snippets.

View kethinov's full-sized avatar
🎩
Wearer of Many Hats

Eric Newport kethinov

🎩
Wearer of Many Hats
View GitHub Profile
@kethinov
kethinov / walksync.js
Created September 22, 2013 09:04
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
/*
* DOMParser HTML extension
* 2012-09-04
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */
/*
* DOMParser HTML extension
* 2012-09-04
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */
PWDMAXLENGTH=30
PROMPTTRUNCSYM="..."
# Change the window title of X terminals
case $TERM in
xterm*|rxvt|Eterm|eterm)
PROMPT_COMMAND_TITLE="\033]0;USER@HOSTNAME:CURRDIR\007"
;;
screen)
PROMPT_COMMAND_TITLE='\033_USER@HOSTNAME:CURRDIR\033\\'
PWDMAXLENGTH=30
PROMPTTRUNCSYM="..."
# Change the window title of X terminals
case $TERM in
xterm*|rxvt|Eterm|eterm)
PROMPT_COMMAND_TITLE="\033]0;USER@HOSTNAME:CURRDIR\007"
;;
screen)
PROMPT_COMMAND_TITLE='\033_USER@HOSTNAME:CURRDIR\033\\'