This file contains hidden or 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
| const angleInRadians = angleInDegrees => (angleInDegrees - 90) * (Math.PI / 180.0); | |
| const polarToCartesian = (centerX, centerY, radius, angleInDegrees) => { | |
| const a = angleInRadians(angleInDegrees); | |
| return { | |
| x: centerX + (radius * Math.cos(a)), | |
| y: centerY + (radius * Math.sin(a)), | |
| }; | |
| }; |
This file contains hidden or 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 compressed(arr) { | |
| const sortedArr = arr.sort((a, b) => a - b); | |
| let result = ""; | |
| let isAdding = false; | |
| let latestLoop = false; | |
| for (let i = 0; i < sortedArr.length; i++) { | |
| const resultElement = sortedArr[i]; | |
| const nextResult = sortedArr[i + 1]; | |
| if ( nextResult === undefined) { | |
| latestLoop = true; |
This file contains hidden or 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
| { | |
| "en_US": { | |
| "ADD": "Add", | |
| "EDIT": "Edit", | |
| "REMOVE": "Remove", | |
| "FILTER": "Filter", | |
| "SEARCH": "Search", | |
| "SAVE": "Save", | |
| "CANCEL": "Cancel", | |
| "CLOSE": "Close", |
This file contains hidden or 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
| refsapp.controller('EditRefItemCtrl', ['$scope', '$uibModalStack', 'PopupService', '$rootScope', 'RefsApiService', 'refItemList', 'isEdit', 'refId', '$filter', 'isCreate', function ($scope, $uibModalStack, PopupService, $rootScope, RefsApiService, refItemList, isEdit, refId, $filter, isCreate) { | |
| $scope.isEdit = isEdit; | |
| $scope.isCreate = isCreate; | |
| $scope.refList = handlerRefList(refItemList); | |
| $scope.isLoad = false; | |
| $scope.modalNameAndButtons = { | |
| modal: !$scope.isEdit ? 'Просмотр записи справочника' : $scope.isCreate ? 'Создание записи справочника' : 'Редактирование записи справочника' | |
| }; | |
| $scope.addItemToVolume = function (arr) { |
This file contains hidden or 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
| /** | |
| * Возможные значения параметра hour | |
| * @hour {*[]} | |
| */ | |
| var gmtList = [ | |
| { | |
| val: '-1', | |
| title: 'Необходимо выбрать часовой пояс' | |
| }, { | |
| val: '0', |
This file contains hidden or 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 () { | |
| var speed = 500; | |
| var moving_frequency = 15; // Affects performance ! | |
| var links = document.getElementsByTagName('a'); | |
| var href; | |
| for (var i = 0; i < links.length; i++) { | |
| href = (links[i].attributes.href === undefined) ? null : links[i].attributes.href.nodeValue.toString(); | |
| if (href !== null && href.length > 1 && href.substr(0, 1) == '#') { | |
| links[i].onclick = function () { | |
| var element; |
This file contains hidden or 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
| var arr = [1,1,2,2,3,3,4,10,10]; | |
| var result = arr.filter(function(item) { | |
| return item === 4; | |
| }); | |
| console.log(result); |
This file contains hidden or 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 range(start, finish, step = 1) { | |
| if (step < 1) throw "Step must be ge 1" | |
| return { | |
| [Symbol.iterator]: function* () { | |
| let count = 1; | |
| yield start | |
| if (start !== finish) { | |
| let tmp = start; | |
| if (start < finish) { | |
| while (tmp < finish) { |