Skip to content

Instantly share code, notes, and snippets.

View Maxim-Kolmogorov's full-sized avatar
☺️
I love my job

Maxim Kolmogorov Maxim-Kolmogorov

☺️
I love my job
View GitHub Profile
@Maxim-Kolmogorov
Maxim-Kolmogorov / plugin.xml
Created January 6, 2021 13:41
Tutorial: Cordova plugin in Swift. Part 3. Modern plugin.xml
<?xml version='1.0' encoding='utf-8'?>
<plugin id="maxim-kolmogorov-echo-test" version="0.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>EchoTest</name>
<js-module name="EchoTest" src="www/EchoTest.js">
<clobbers target="echotest" />
</js-module>
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="EchoTest">
<param name="ios-package" value="EchoTest" />
@Maxim-Kolmogorov
Maxim-Kolmogorov / EchoTest.js
Created January 6, 2021 13:32
Tutorial: Cordova plugin in Swift. Part 2.
var exec = require('cordova/exec');
exports.echo = function(arg0, success, error) {
exec(success, error, 'EchoTest', 'echo', [arg0]);
};
@Maxim-Kolmogorov
Maxim-Kolmogorov / plugin.xml
Last active January 6, 2021 13:18
Tutorial: Cordova plugin in Swift. Part 1.
<?xml version='1.0' encoding='utf-8'?>
<plugin id="maxim-kolmogorov-echo-test" version="0.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>EchoTest</name>
<js-module name="EchoTest" src="www/EchoTest.js">
<clobbers target="echotest" />
</js-module>
</plugin>
@Maxim-Kolmogorov
Maxim-Kolmogorov / Face_Touch_ID_Authorization.swift
Created November 2, 2020 04:25
Face/Touch ID Authorization
import LocalAuthentication
private func indetifyYourself() {
let context = LAContext()
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
let reason = "Идентифицируйте себя"
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason ) { success, error in
@Maxim-Kolmogorov
Maxim-Kolmogorov / Vue_phone_mask.js
Last active February 8, 2025 09:45
Phone mask with Vue.js
import Vue from "vue"
Vue.directive('phone', {
bind(el) {
el.oninput = function(e) {
if (!e.isTrusted) {
return
}
const x = this.value.replace(/\D/g, '').match(/(\d{0,1})(\d{0,3})(\d{0,3})(\d{0,4})/)
<div class="breadcrumbs" itemscope="" itemtype="http://schema.org/BreadcrumbList">
<div itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem">
<a href="/" itemprop="item">
<span itemprop="name">Главная</span>
<meta itemprop="position" content="1">
</a>
</div>
<span class="separator">-</span>
<div itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem">
<a href="/catalog/" itemprop="item">
@Maxim-Kolmogorov
Maxim-Kolmogorov / microdata-logo.html
Created August 6, 2020 13:11
Пример микроразметки JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"url": "http://www.example.com",
"logo": "http://www.example.com/images/logo.png"
}
</script>
@Maxim-Kolmogorov
Maxim-Kolmogorov / 301.json
Last active February 26, 2021 05:26
Node.js 301 redirect for Nuxt.js
[
{ "from": "/old", "to": "https://new-site.ru" },
{ "from": "/old2", "to": "/new" }
]
<?php
$secret = 'ВАШ_СЕКРЕТНЫЙ_КЛЮЧ';
$params = array(
'secret' => $secret,
'response' => $_SESSION['recaptcha_token'],
);
$myCurl = curl_init();
curl_setopt_array($myCurl, array(
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
session_start();
$_POST = json_decode(file_get_contents('php://input'), true);
$_SESSION['recaptcha_token'] = $_POST['token'];
} else {
http_response_code(404);
header('Location: /404.html');
exit;
}