- Http://www.linkedin.com/in/ptdecker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// serialNumInfo() | |
// | |
// Evaluates a mobile device serial number, determines its type (ESN, IMEI, MEID) and attempts | |
// to check for validity if possible. | |
// | |
// When the passed purported serial number, the serialNumInfo() function returns a boolean flag | |
// ('isValid') indicating the validity of the number along with 'numType' indicating the type of | |
// serial number passed. The function expects the passed serialNumber to be not contain any | |
// spaces and for hexadecimal values to be passed without a leading "0x" or "0h" prefix. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// getOfferClasses() | |
// | |
// Returns an array that represents the _types_ of plans (i.e. offer classes) that should be offered to the | |
// customer. An empty array is returned if an offer class cannot be determined due to a coding error and the | |
// caller needs to handle accordingly. | |
// | |
// Parameters: | |
// custSegment - String customer segment ('A'-Port, 'B'-New, 'C'-Migrator, 'D'-Legacy, 'E'-Inner Circle) | |
// deviceType - String identifying type of device ('byo'-BYOD, 'c_pl'-Certified Preloved, 'new'-New Device) | |
// isAppleICDevice - Boolean true if the device is Apple and qualified for an Inner Circle plan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cardInfo() | |
// | |
// Determines if a credit card number is valid and returns the name of the issuing network. When | |
// passed a purported card number as a candidate if the card number is valid, the cardInfo() | |
// function returns a boolean flag ('isValid') indicating if the card is a valid number and a | |
// string ('network') containing the name of the issuing network. Card validity is determined | |
// based upon the card number length and Luhn check digit value. Valid card lengths are based | |
// upon the card lengths valid for a given issuing network. The Luhn check digit is calculated | |
// using the Luhn algorithm. The function contains a static table ('IINData') that defines the | |
// supported issuing network. The table is not a complete list--it is only meant to contain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
// Configuration values that are global to the store. These would need |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Configuration values that are global to the store. These would need | |
// some sort of a Magento dialog to allow the business team to maintain | |
// them. Values are stored in cents to avoid JavaScript floating point | |
// issues | |
// | |
// standardShippingRate | |
// The amount of shipping that should be charged on a per item | |
// basis unless the individual SKU has a special shipping charge | |
// freeShippingThreshold | |
// The amount of the sub-total of the cart of the items that do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Control Flow 5 - Concurrency Limited Functions Using an Array of Functions and Callbacks | |
* | |
* Based on: | |
* - http://book.mixu.net/node/ch7.html | |
* - https://github.com/mixu | |
* | |
* The 'Array.prototype.slice.call(arguments)' usage is a JavaScript trick and explained here: | |
* - http://mariapacana.tumblr.com/post/79170518832/javascript-tricks | |
* - http://stackoverflow.com/questions/7056925/how-does-array-prototype-slice-call-work | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Control Flow 4 - Serial Execution of an Array of Callback Functions | |
* | |
* Based on: | |
* - http://book.mixu.net/node/ch7.html | |
* - https://github.com/mixu | |
* | |
* Revised based upon comments from 'lanzz' to use 'process.nextTick(next)' instead of 'next()' | |
* Revised based upon comments from 'Israel' to use "typeof(callback) != 'undefined'" | |
* | |
* The 'Array.prototype.slice.call(arguments)' usage is a JavaScript trick and explained here: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Control Flow 3 - Rate Limited Concurrent Execution of an Asynchronous Function | |
* | |
* Based on: | |
* - http://book.mixu.net/node/ch7.html | |
* - https://github.com/mixu | |
* | |
* Characteristics: | |
* - Runs a number of operations concurrently | |
* - Starts a limited number of operations concurrently (partial concurrency, full concurrency control) | |
* - No guarantee of order, only that all the operations have been completed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Control Flow 2 - Fully Concurrent Executions of a Function (not rate limited) | |
* | |
* Based on: | |
* - http://book.mixu.net/node/ch7.html | |
* - https://github.com/mixu | |
* | |
* Characteristics: | |
* | |
* - Runs a number of operations concurrently | |
* - Starts all async operations near simultaneously (full concurrency) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Control Flow 1 - Repetitive Serial Execution of an Asynchronous Function | |
* | |
* Based on: | |
* - http://book.mixu.net/node/ch7.html | |
* - https://github.com/mixu | |
* | |
* Revised to use "typeof(first_item) != 'undefined'" based upon comments from 'Israel' | |
* | |
* Characteristics: | |
* - Flow control construct 'series' is recursive |
NewerOlder