I hereby claim:
- I am ryanhamley on github.
- I am rhamley (https://keybase.io/rhamley) on keybase.
- I have a public key ASCp8_FUT1irc025hMA6hOgjzH7e_Ljo8_P3xNbh-CmN0Ao
To claim this, I am signing this object:
Event.getDateRange = function (start, end, cb){ | |
var params = { | |
q: { | |
filters: [ | |
{ | |
name: 'occurrences', | |
op: 'any', | |
val: { | |
'name': 'date', | |
'op': 'gte', |
/** | |
* [checkForDuplicateObjects recursively checks an array of objects for duplicate values using angular.equals() to deeply compare objects.] | |
* @param {[array]} _array [the array of objects to be checked] | |
* @return {[boolean]} true or falsey [the function will return true if duplicates are found] | |
*/ | |
function checkForDuplicateObjects(_array) { | |
if (_array.length > 1) { | |
var first = _array[0]; | |
for (var i = 1; i < _array.length; i++) { |
/** | |
* [getDigitAt method for numbers that will return either the digit at a specified position or the section of the number between two positions] | |
* @param {[number]} position1 [either the position to search for or the starting position of the slice] | |
* @param {[number]} position2 [*optional*, if supplied, this creates a slice and acts as the end position] | |
* @return {[number]} [either the digit at the specified position or the slice between the specified positions] | |
*/ | |
Number.prototype.getDigitAt = function (position1, position2) { | |
//convert the number to a string to allow array-like access | |
var num = this.valueOf().toString(); |
$http.get('/views/includes/datepicker.html', { | |
cache: $templateCache | |
}).success(function(template) { | |
element.after($compile(template)(scope)); | |
}); |
angular.module('myApp') | |
.directive('ignoreMouseWheel', function () { | |
return { | |
restrict: 'A', | |
link: function (scope, element) { | |
element.bind('mousewheel', function() { | |
element[0].blur(); | |
}); | |
} | |
}; |
//This function makes use of the getDigitAt() method which is found in a gist here: https://gist.github.com/ryanhamley/73140d5e9710a9a71fa0 | |
function verifyCardType (_num) { | |
//cast primitive number _num to a Number object to allow for using the getDigitAt() method | |
var num = Number(_num); | |
if (num.getDigitAt(0) === 4) { | |
return 'Visa'; | |
} | |
switch (num.getDigitAt(0, 2)) { |
/** | |
* [verifyCardNumber implements the Luhn algorithm (http://en.wikipedia.org/wiki/Luhn_algorithm), which is a checksum algorithm to determine card validity. This implementation was developed by BrainJar (http://www.brainjar.com/js/validation/default2.asp)] | |
* @param {[string]} _num [the credit card number in string format] | |
* @return {Boolean} [true if valid, else false] | |
*/ | |
function verifyCardNumber (_num) { | |
var i, sum, digit, reverse, modified; | |
// First, reverse the string and remove any non-numeric characters. | |
reverse = ''; |
angular.module('managerApp') | |
.directive('time', function () { | |
return { | |
restrict: 'A', | |
require: 'ngModel', | |
link: function postLink(scope, element, attrs, ngModelController) { | |
//convert data from view format to model format | |
ngModelController.$parsers.push(function(data) { | |
if(window.ui.browser !== 'Chrome') { | |
var amPM = data.substring(data.length-2, data.length); |
var log_file = fs.createWriteStream(__dirname + '/debug.log', {flags : 'w'}); | |
var log_stdout = process.stdout; | |
console.log = function(d) { // | |
log_file.write(util.format(d) + '\n'); | |
log_stdout.write(util.format(d) + '\n'); | |
}; |
I hereby claim:
To claim this, I am signing this object: