Skip to content

Instantly share code, notes, and snippets.

View vikaskanani's full-sized avatar

Vikas Patel vikaskanani

View GitHub Profile
$.validator.addMethod('SocialSecurity',
function (value) {
return validSSN(value) || value == "";
}, 'Please enter a valid SSN'
);
function validSSN(value) {
var regex = /^([0-6]\d{2}|7[0-6]\d|77[0-2])([ \-]?)(\d{2})\2(\d{4})$/;
if (!regex.test(value)) {
return false;
@jakub-g
jakub-g / cleanEmptyFoldersRecursively.js
Created April 3, 2015 15:31
nodejs: remove empty directories recursively
function cleanEmptyFoldersRecursively(folder) {
var fs = require('fs');
var path = require('path');
var isDir = fs.statSync(folder).isDirectory();
if (!isDir) {
return;
}
var files = fs.readdirSync(folder);