Skip to content

Instantly share code, notes, and snippets.

@zogreptile
zogreptile / deploy.md
Last active March 20, 2019 11:17
Deploy to gh-pages with github access token

package.json

"homepage": "https://<username>.github.io/<reponame>",
"scripts": {
  "predeploy": "npm|yarn run build",
  "deploy": "gh-pages -d build"
}

Github

Flow

mini GitHub API client

First screen: owner (organization or user) name input and submit button.

Treat organizations as users: unconditionally use /users/${owner}/repos API.

On submit: show cards with repositories, filters, and sorting.

@zogreptile
zogreptile / breadcrumbs.txt
Created July 9, 2018 00:47
Типовой breadcrumbs - nunjucks, scss, модель данных
<nav class="breadcrumbs">
<div class="container">
<ul class="breadcrumbs__list">
{% for item in BREADCRUMBS_DATA %}
<li class="breadcrumbs__item">
{% if loop.last %}
<span>{{ item.text }}</span>
{% else %}
<a href="{{ item.url }}">{{ item.text }}</a>
{% endif %}
@zogreptile
zogreptile / gray-yamap.css
Created April 26, 2018 00:09
Черно-белая яндекс карта.
[class*="ymaps-2"][class*="-ground-pane"] {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
-webkit-filter: grayscale(100%);
}
@zogreptile
zogreptile / yamap-geocode.js
Created April 19, 2018 07:09
Метка на яндекс карте по геокодеру.
ymaps.ready(function () {
var geocoder = ymaps.geocode("{{ object_item.address }}", {result: 1});
geocoder.then(
function (res) {
var point = res.geoObjects.get(0),
mapCenter = point.geometry.getCoordinates();
var map = new ymaps.Map('map', {
center: mapCenter,
@zogreptile
zogreptile / column-count.css
Created April 10, 2018 23:43
Запрет переноса для column-count.
.parent {
column-count: 3;
}
.child {
break-inside: avoid-column;
}
$('#slider')
.on('init', function () {
$(this).removeClass('slider--before-init');
})
.slick({
arrows: false,
autoplay: true,
autoplaySpeed: 5000,
infinite: true,
speed: 300,
@zogreptile
zogreptile / retina-media.css
Last active May 8, 2018 11:13
Детект ретины.
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and ( min--moz-device-pixel-ratio: 2),
only screen and ( -o-min-device-pixel-ratio: 2/1),
only screen and ( min-device-pixel-ratio: 2),
only screen and ( min-resolution: 192dpi),
only screen and ( min-resolution: 2dppx) {
}
@zogreptile
zogreptile / prevent-selection.css
Last active April 2, 2018 12:12
Запретить выделение.
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
@zogreptile
zogreptile / ya-map.js
Last active March 21, 2018 23:52
Несколько объектов на яндекс карте. Позиционирование метки.
ymaps.ready(init);
var myMap,
myPlacemark;
var places = [
{
name: 'Точка № 1',
lat: 48.471125,
long: 135.058703
},