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 / 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,
$('#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
},
В переменные среды добавить CMDER_ROOT: <путь к папке cmder>
{
"workbench.colorTheme": "Ayu Mirage",
"workbench.iconTheme": "ayu",
"extensions.ignoreRecommendations": false,
"window.zoomLevel": 0,
"terminal.integrated.shellArgs.windows": [
"cmd /k",
"%CMDER_ROOT%\\vendor\\init.bat"
@zogreptile
zogreptile / mobile-user-agent-check.js
Created September 26, 2017 04:00
Check if user agent is mobile
function isMobile() {
if (
navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/i) ||
navigator.userAgent.match(/Windows Phone/i)
) {