Skip to content

Instantly share code, notes, and snippets.

@Wockeez
Wockeez / .block
Created June 2, 2022 07:00 — forked from clhenrick/.block
Custom tiles in Google Maps
license: apache-2.0
@Wockeez
Wockeez / cadastre_regexp.js
Created May 4, 2022 11:23
cadastre number pattern regexp (ru)
const cadastrePattern = new RegExp('\\d{1,2}:\\d{1,2}:\\d{6,7}:\\d{1,4}', 'gm');
console.log('89:08:1111111:1'.match(cadastrePattern))
@Wockeez
Wockeez / nginx.conf
Created March 10, 2022 07:30 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@Wockeez
Wockeez / gist:ad57ee281837dc353474fef4ab647152
Last active January 24, 2022 12:56 — forked from realmyst/gist:1262561
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@Wockeez
Wockeez / mail.php
Created May 8, 2021 10:44 — forked from sharkyak/mail.php
axios vue mail post
<?php
$to = "[email protected]"; // адрес куда отправлять письмо
$subject = "Отправка формы с сайта"; // заголовок письма
$_POST = json_decode(file_get_contents('php://input'), true);
foreach($_POST as $key => $value)
{ $fields .= $key.": ".$value." \r\n"; }
$message = $subject." \r\n".$fields;
$headers = "Content-type: text/plain; charset=utf-8 \r\n";
@Wockeez
Wockeez / Regions.json
Created March 30, 2021 11:58 — forked from max107/Regions.json
Russia regions with coords. Регионы россии с координатами границ.
{
"Алтайский край": {
"0": [
[
54.469437,
85.079468
],
[
54.195824,
85.44720500000001
@Wockeez
Wockeez / main.js
Last active November 6, 2021 03:36
Самые короткие однострочные вкладыши для ES6+
Найдите уникальные id's в массиве.
arr.filter((v,i,a)=>a.findIndex(t=>(t.id === v.id))===i)
Уникальный по нескольким свойствам ( place и name )
arr.filter((v,i,a)=>a.findIndex(t=>(t.place === v.place && t.name===v.name))===i)
Уникальный по всем свойствам (это будет медленно для больших массивов)
arr.filter((v,i,a)=>a.findIndex(t=>(JSON.stringify(t) === JSON.stringify(v)))===i)
Сохраните последнее событие.
@Wockeez
Wockeez / loading.css
Created January 12, 2021 08:19 — forked from colbyfayock/loading.css
CSS Loading Animation
/**
* Loading Animation Snippet
*/
.loading {
color: transparent;
background: linear-gradient(100deg, #eceff1 30%, #f6f7f8 50%, #eceff1 70%);
background-size: 400%;
animation: loading 1.2s ease-in-out infinite;
}