Skip to content

Instantly share code, notes, and snippets.

<?php
function replace_area_format(string $area): string
{
$pattern = [
'/\bсот(к[а|и]|ок)\b/ui' => 'сот.',
'/\b(гектар)(|[ы]|(а|ов))\b/ui' => 'Га',
'/\b(кв(.\s?)м)(|етр)(|ов|а)\b/ui' => 'м²',
];
{
fields: [
{
id: 2,
name: '\u0422\u0438\u043f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f',
slug: 'offer-type',
base_slug: 'offer_type',
parent_id: 0,
type: 'select',
is_number: false,
@evikza
evikza / jquery.fancybox.js
Created March 19, 2022 14:46
Added rutube-embed video to fancyBox v3.5.7
// ==================================================
// fancyBox v3.5.7
//
// Licensed GPLv3 for open source use
// or fancyBox Commercial License for commercial use
//
// http://fancyapps.com/fancybox/
// Copyright 2022 fancyApps
//
// ==================================================
@evikza
evikza / vc_.json
Last active February 18, 2022 18:55
/ 20220218235112
// http://fqe0/_dt.php
{
"Лера Михайлова": [
367581,
294822
],
"Maria Sysoikina": [
367581,
@evikza
evikza / index.js
Last active September 14, 2021 02:50
Проверка ОГРН и ОГРНИП
function isPrimaryStateRegistrationNumber($number) {
let n = $number.length == 13 ? 11 : $number.length == 15 ? 13 : 0,
j = $number.slice(0, -1),
v = j / n,
g = v.toString().replace(/\..*/gm, '') * n,
f = (j - g).toString(),
k = f > 9 ? f.slice(-1) : f,
t = k == $number.toString().slice(-1);
return t;
@evikza
evikza / ydoWorkerId.js
Last active March 31, 2022 11:34
Get value `worker_id` from https://yandex.ru/uslugi/
document['documentElement']['outerHTML']
['match'](/"ydoWorkerId":(["\w"|-])+/m)[0x0]
['split'](':')[0x1]
['replaceAll']('\x22', '');
// "ydoWorkerId":"(.*?)"
@evikza
evikza / latest.php
Created February 9, 2021 16:47
Получения котировок ЦБ РФ в формате JSON с cbr.ru
<?php
$request = simplexml_load_string(
file_get_contents(
$uri = 'https://www.cbr.ru/scripts/XML_daily.asp',
false,
stream_context_create([
'http' => [
'method' => 'GET',
'header' =>
@evikza
evikza / paths.json
Last active September 1, 2020 19:18
[
{
"pathName": "path22",
"pathMass": [
{
"x": 3823.8979,
"y": 1195.8703
},
{
"x": 30.3906,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Generation qr-code 🤠</title>
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/picnic" />
<!-- Подключаем файл jsPDF.js -->
!(function() {
'use strict';
var e = function() {
this.init();
};
e.prototype = {
init: function() {
var e = this || _;
return (
(e._counter = 1e3),