Archive for April 27th, 2008

Filed in: , ,
Posted On: 2008 / 04 / 27

For my next stuff I needed the Javascript equivalents of PHP functions basename() and dirname(). Nothing genius: < View plain text > javascript function basename(path) {     return path.replace(/\\/g,'/').replace( /.*\//, '' ); }   function dirname(path) {     return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');; } It obviously supports paths like /home/ozh/stuff.php, http://site.com/file.ext or double backslashed Win32 […][...] → Read more

Filed in: , , , , ,
Posted On: 2008 / 04 / 27

This tatoo doesn't even validate, duh! (via the always entertaining pics.reddit)[...] → Read more