Skip to content

Instantly share code, notes, and snippets.

@dmitrye
dmitrye / .bash_profile
Created October 26, 2016 04:53 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@dmitrye
dmitrye / validate_credit_card.js
Last active February 1, 2018 16:42 — forked from DiegoSalazar/validate_credit_card.js
JavaScript Luhn validator method. Modifications made here include support for non-numeric characters in the value being cleaned up instead of rejecting the value. Also, cleaned up a duplicate variable and added identity check at the end instead of equality check.
// takes the form field value and returns true on valid number
function valid_credit_card(value) {
// The Luhn Algorithm. It's so pretty.
var nCheck = 0, bEven = false;
//this will remove all non-numeric characters and validate against remaining code.
//therefore this now supports 4111-1111-1111-1111 patterns as an example
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {