A Pen by Michael Chambaud on CodePen.
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
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 |
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
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]; | |
}); | |
} |
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
root = true | |
[*] | |
indent_style = space | |
indent_size = 4 | |
end_of_line = lf | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
insert_final_newline = true |
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
angular.module('pascalprecht.translate') | |
.factory('$translateMissingTranslationHandlerLogRaygun', function ($window) { | |
return function (translationId) { | |
$window.Raygun.send('Missing Translation', {translationKey: translationId}); | |
}; | |
}); |
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
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; |
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
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 | |
; | |
}); | |
}; |
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
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)); | |
}; | |
} |
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
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; | |
}; | |
} |