<view id="icon-figure" viewBox="0 0 30 30" />
// https://code.jquery.com/jquery-3.5.0.js
/**
* Load a url into a page
*/
jQuery.fn.load = function( url, params, callback ) {
var selector, type, response,
self = this,
off = url.indexOf( " " );
if ( off > -1 ) {
selector = stripAndCollapse( url.slice( off ) );
url = url.slice( 0, off );
}
// If it's a function
if ( isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax( {
url: url,
// If "type" variable is undefined, then "GET" method will be used.
// Make value of this field explicit since
// user can override it through ajaxSetup method
type: type || "GET",
dataType: "html",
data: params
} ).done( function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
// If the request succeeds, this function gets "data", "status", "jqXHR"
// but they are ignored because response was set above.
// If it fails, this function gets "jqXHR", "status", "error"
} ).always( callback && function( jqXHR, status ) {
self.each( function() {
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
} );
} );
}
return this;
};
$("input#email").inputmask({
mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]",
greedy: false,
clearMaskOnLostFocus: false,
onBeforeWrite: function (event, buffer, caretPos, opts) {
buffer.forEach(function(item, i, buffer) {
if (item == '@') {
buffer[i+1] = 'g';
buffer[i+2] = 'm';
buffer[i+3] = 'a';
buffer[i+4] = 'i';
buffer[i+5] = 'l';
buffer[i+6] = '.';
buffer[i+7] = 'c';
buffer[i+8] = 'o';
buffer[i+9] = 'm';
buffer.length = i+10;
}
});
}
});
(attr) Get the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.
(prop) Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element.
что-то не получается с ними работать
const fs = map.controls.get('fullscreenControl');
fs.events.add('fullscreenenter', () => console.log('ON'));
fs.events.add('fullscreenexit', () => console.log('OFF'));
создал локальную ветку задачи branchTaskName от локальной develop-ветки (предварительно ее обновив)
Нужно ли мне обновлять свою ветку задачи branchTaskName свежими изменениями?
Как правильно обновить ветку задачи branchTaskName чтобы не было проблем при отправке своей ветки в удаленный репозиторий?
git merge develop
. Это бессмысленные манипуляции. Достаточно просто скачать к себе в локальный репозиторий обновления внешнего репозитория git fetch
(Лайвхак: эту операцию можно автоматизировать. Настройте автоматическое выполнение fetch по расписанию, и у вас всегда будет под рукой доступ к актуальному проекту). Затем сделайте git merge origin/develop. Указатель origin/develop это и есть ссылка на состояние проекта на момент последнего скачивания (fetch). В принципе эти два шага эквивалентны одной команде git pull origin develop
— внутри делается всё то же самое.git fetch
, затем собственно пересадим ветку на актуальное состояние git rebase develop
. Последний вариант мне нравится тем, что история не засоряется коммитами слияния. Но тут предполагается, что тематическая ветка принадлежит только вам и никто больше в ней не работает. Так как после пересадки её придётся удалять из внешнего репозитория и создавать там заново через git push --force
. Если работа над фичей ведётся совместно с коллегами, то такой рабочий процесс не очень подойдёт.let user = {
name: "David",
age: 25,
}
function objectClone(object) {
let newObject = {};
for (let key in object) {
newObject[key] = object[key];
}
return newObject;
}
let user2 = objectClone(user);
console.log(user2.name); // выводит "David"
var points = [
[55.831903,37.411961],
[55.763338,37.565466],
[55.763338,37.565466],
[55.744522,37.616378],
[55.780898,37.642889]
],
markers = {};
ymaps.ready(function () {
ymaps.option.presetStorage.add('custom#default', {
iconLayout: 'default#image',
iconImageHref: 'marker.png',
iconImageSize: [30, 40],
iconImageOffset: [-15, -40],
iconImageClipRect: [
[0, 30],
[30, 70]
],
hideIconOnBalloonOpen: false
});
ymaps.option.presetStorage.add('custom#active', {
iconLayout: 'default#image',
iconImageHref: 'marker.png',
iconImageSize: [30, 40],
iconImageOffset: [-15, -40],
iconImageClipRect: [
[0, 70],
[30, 110]
],
hideIconOnBalloonOpen: false
});
var myMap = new ymaps.Map('map', {
center: [55.751574, 37.573856],
zoom: 9
});
for (var i = 1; i <= points.length; i++) {
markers['id' + i] = new ymaps.Placemark(
points[i - 1],
{
hintContent: 'Какая красивая метка...'
},
{
preset: 'custom#default'
}
);
$('<a href="#" data-type="marker" data-id="id' + i + '">').html(i + '-я метка').appendTo($(document.body));
}
placemark.events.add('click', function (e) {
changeMarker(e.get('target'));
});
myMap.geoObjects.add(placemark);
});
function changeMarker (marker) {
marker.options.set('preset', {
preset: 'custom#active'
});
}
$(document).on('click', 'a[data-id][data-type="marker"]', function (e) {
e.stopPropagation();
e.preventDefault();
changeMarker(markers[$(this).data('id')]);
});
const path = require('path');
const gulp = require('gulp');
const pug = require('gulp-pug');
const cities = [
{
cityName : 'city1',
},
{
cityName : 'city2',
}
];
gulp.task('views', function(done) {
cities.forEach(function(city, index, cities) {
gulp.src('template/city.pug')
.pipe(pug({
data : city
}))
.pipe(gulp.dest(path.join('..', '..', 'domains', city.cityName)));
});
done();
});