Skip to content

Instantly share code, notes, and snippets.

antonlukin /
Last active Nov 19, 2020
How to send ga events for special in

Для отслеживания события нужно добавить в глобальную переменную dataLayer специальный объект вида:

dataLayer = window.dataLayer || [];
  'event': 'event-to-ga',
  'eventCategory': category,
  'eventAction': action,
  'eventLabel': label,
  'eventValue': value,
antonlukin / knife-facebook-lua.conf
Last active Jul 31, 2020
Parse facebook share counter using nginx with lua extension
View knife-facebook-lua.conf
location /facebook-share/ {
set $token "${args}&layout=button_count&locale=en_US";
proxy_ignore_headers Expires;
proxy_ignore_headers Cache-Control;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
antonlukin / unique-slug.php
Created May 14, 2020
Prevent to create WordPress posts and pages with custom reserved slug
View unique-slug.php
add_filter('wp_unique_post_slug_is_bad_flat_slug', function($bad_slug, $slug) {
if($slug === 'social') {
return true;
return $bad_slug;
}, 10, 2);
antonlukin / index.html
Created Apr 16, 2020
Pass variable to SSI template with nginx
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test your knowlege!</title>
<h1>I answered <!--# echo var="count" --> questions correctly!</h1>
antonlukin /
Last active Jun 1, 2020
iptables common rules
# Drop for eth0 all incoming connections
sudo iptables -A INPUT -i eth0 -p tcp --dport 3000 -j DROP
# Save rules
sudo service netfilter-persistent save
antonlukin / docker-compose.yaml
Created Apr 14, 2020
Mysql only docker-compose
View docker-compose.yaml
version: '3.7'
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
antonlukin / snippets.php
Created Feb 9, 2020
Custom snippets to upgrade instapress theme
View snippets.php
* Plugin name: Snippets for
* Description: Custom snippets to upgrade instapress theme
* Author: Anton Lukin
* Author URI:
* Version: 1.0
antonlukin /
Created Nov 17, 2019 — forked from spalladino/
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
View knife-facebook.conf
location /facebook/ {
access_log off;
log_not_found off;
set $token "${args}&access_token=";
if ( $arg_id ~ "^" ) {
set $args $token;
antonlukin / share-buttons.js
Created Apr 19, 2019
share buttons manager
View share-buttons.js
* Share buttons manager
(function () {
var counters = {
facebook: false,
vkontakte: false,
odnoklassniki: false