Skip to content

Instantly share code, notes, and snippets.

View artemsites's full-sized avatar

Artem Sites Kuznecov artemsites

View GitHub Profile
@artemsites
artemsites / reset.css
Created February 9, 2025 18:37 — forked from DavidWells/reset.css
CSS reset. Follow me on the twitters for more tips: https://twitter.com/davidwells
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
function throttle(func, limit) {
let lastFunc
let lastRan
return function(...args) {
if (!lastRan) {
func.apply(this, args)
lastRan = Date.now()
} else {
clearTimeout(lastFunc)
lastFunc = setTimeout(() => {

Так выглядит спрайт

<svg width="0" height="0" style="display: none;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <symbol id="faq-v3-ico-3" viewBox="0 0 31 30">
    <circle fill="var(--color)" cx="15.4" cy="15" r="15" />
    <path fill="var(--color-inverse)" d="M6.4 12c0-.1.04-.18.1-.26a.35.35 0 0 1 .26-.1h4.9c.1 0 .19-.04.26-.12a.35.35 0 0 0 .11-.25v-4.9c0-.1.04-.19.11-.26A.35.35 0 0 1 12.4 6h6c.1 0 .18.04.25.11.08.07.11.16.11.26v4.9c0 .1.04.18.11.25.08.08.16.11.26.11h4.9c.1 0 .19.04.26.11.07.08.1.16.1.26v6c0 .1-.03.18-.1.26a.35.35 0 0 1-.26.1h-4.9c-.1 0-.18.04-.26.12a.35.35 0 0 0-.1.25v4.9c0 .1-.04.19-.12.26a.35.35 0 0 1-.25.11h-6a.35.35 0 0 1-.26-.11.35.35 0 0 1-.1-.26v-4.9c0-.1-.04-.18-.12-.25a.35.35 0 0 0-.25-.11h-4.9a.35.35 0 0 1-.26-.11.35.35 0 0 1-.11-.26v-6Z" />
  </symbol>
</svg>
/**
* Выполнять колбэк только по прошествии указанного времени (с момента последнего вызова)
*
* @example
* let setUnsetSwiperTouchMove = debounce(function (e) {
* if (canScrollX($el)) {
* disableSwiperTouchMove($el, swiper);
* } else {
* enableSwiperTouchMove($el, swiper);
* }
<?php
function transliterate($text, $lowercase=false, $spaceToDash=false) {
$transliterationTable = array(
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd',
'е' => 'e', 'ё' => 'yo', 'ж' => 'zh', 'з' => 'z', 'и' => 'i',
'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n',
'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't',
'у' => 'u', 'ф' => 'f', 'х' => 'kh', 'ц' => 'ts', 'ч' => 'ch',
'ш' => 'sh', 'щ' => 'shch', 'ъ' => '', 'ы' => 'y', 'ь' => '',
'э' => 'e', 'ю' => 'yu', 'я' => 'ya',
export function checkArraysContainSameObjects(arr1, arr2, key) {
if (arr1.length !== arr2.length) {
return false
}
return arr1.every(arr1Obj => arr2.some(arr2Obj => arr1Obj[key] === arr2Obj[key]))
}
@artemsites
artemsites / regexp.js
Last active September 16, 2024 18:37
/**
* @version 16.09.2024
* import { getClearPhone } from "/src/utils/regexp.js"
*/
export function getClearPhone(str) {
return str.replace(/[^+0-9]/g, "")
}
<template>
<Teleport to="body">
<Transition>
<div v-if="isOpen" class="popup-overlay" @click="closePopup">
<div class="popup-content" @click.stop>
<button class="popup-close" @click="closePopup">
&times;
</button>
<slot></slot>
/**
* import { copyToClipboard } from "/src/utils/copyToClipboard.js"
*
* copyToClipboard("Этот текст будет скопирован в буфер обмена")
*/
export function copyToClipboard(text, callback) {
const textarea = document.createElement('textarea')
textarea.value = text
document.body.appendChild(textarea)

Отключить свайп

tns({ 
  swipeAngle: -1,            
})