Skip to content

Instantly share code, notes, and snippets.

View developandbehappy's full-sized avatar
🎯
Focusing

Who am i? developandbehappy

🎯
Focusing
View GitHub Profile
@developandbehappy
developandbehappy / Iterables.es6.js
Last active August 29, 2015 14:27 — forked from asm0dey/Iterables.es6.js
Simple library with lazy es6 iterables. If you use es5 - don't forget to add es5 polyfill
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) {
var arr = [1,1,2,2,3,3,4,10,10];
var result = arr.filter(function(item) {
return item === 4;
});
console.log(result);
(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;
/**
* Возможные значения параметра hour
* @hour {*[]}
*/
var gmtList = [
{
val: '-1',
title: 'Необходимо выбрать часовой пояс'
}, {
val: '0',
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) {
{
"en_US": {
"ADD": "Add",
"EDIT": "Edit",
"REMOVE": "Remove",
"FILTER": "Filter",
"SEARCH": "Search",
"SAVE": "Save",
"CANCEL": "Cancel",
"CLOSE": "Close",
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;
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)),
};
};