Player POC
A Pen by Michael Chambaud on CodePen.
function searchChallenge(strArr: string[]): number { | |
let contiguousRegions = 0; | |
const matrix: number[][] = strArr.map((x: string): number[] => x.split('') | |
.map((y: string): number => +y)); | |
const search = (row: number, col: number) => { | |
if (row >= 0 && row < matrix.length && col >= 0 && col < matrix[row].length && matrix[row][col] === 0) { | |
matrix[row][col] = 2; | |
// up |
function isArithmetic(arr: number[]): boolean { | |
return arr.every((x: number, i: number) => { | |
if (i < 2) { | |
return true; | |
} | |
return arr[i] - arr[i-1] === arr[i-1] - arr[i-2]; | |
}); | |
} |
root = true | |
[*] | |
indent_style = space | |
indent_size = 4 | |
end_of_line = lf | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
insert_final_newline = true |
angular.module('pascalprecht.translate') | |
.factory('$translateMissingTranslationHandlerLogRaygun', function ($window) { | |
return function (translationId) { | |
$window.Raygun.send('Missing Translation', {translationKey: translationId}); | |
}; | |
}); |
app.config(function ($provide) { | |
$provide.decorator('$rootScope', function ($delegate) { | |
var originalEmitFn = $delegate.$emit; | |
$delegate.$emit = function () { | |
console.log.apply(console, arguments); | |
originalEmitFn.apply(this, arguments) | |
} | |
return $delegate; |
A Pen by Michael Chambaud on CodePen.
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var args = arguments; | |
return this.replace(/{(\d+)}/g, function(match, number) { | |
return typeof args[number] != 'undefined' | |
? args[number] | |
: match | |
; | |
}); | |
}; |
if (!String.prototype.padRight) { | |
String.prototype.padRight = function (length, str) { | |
str = str || ' '; | |
return this.length >= length | |
? this | |
: this + (new Array(Math.ceil((length - this.length) / str.length) + 1).join(str)).substr(0, (length - this.length)); | |
}; | |
} |
if (!String.prototype.padLeft) { | |
String.prototype.padLeft = function (length, str) { | |
str = str || ' '; | |
return this.length >= length | |
? this | |
: (new Array(Math.ceil((length - this.length) / str.length) + 1).join(str)).substr(0, (length - this.length)) + this; | |
}; | |
} |