Skip to content

Instantly share code, notes, and snippets.

@timba64
timba64 / Brand.php
Last active August 3, 2023 16:19
Some troubles with EasyAdmin 3 and KnpLabs/DoctrineBehaviors/translatable in Symfony 5.3
<?php
namespace App\Entity;
use App\Repository\BrandRepository;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
@timba64
timba64 / .cpanel.yml
Created October 26, 2018 09:08
Deployment site in cPanel of hoster.by
---
deployment:
tasks:
- export REPOPATH=/home/abram/testogit/*
- export SITEPATH=/home/abram/testo.domen.by/
- /bin/rsync -rav --exclude '.git' --exclude '.cpanel.yml' --del $REPOPATH $SITEPATH
@timba64
timba64 / ProductCrudController.php
Last active November 25, 2021 09:32
Select for OneToMany Entity in EasyAdmin
<?php
namespace App\Controller\Admin;
use App\Entity\Product;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField;
use App\Form\Field\TranslationField;
@timba64
timba64 / function.php
Last active October 25, 2021 14:13 — forked from nandomoreirame/function.php
WordPress REST API send email SMTP in with PHPMailer
<?php
function sendWithPhpMailer($subject, $body, $reply) {
require(ABSPATH . WPINC . '/class-phpmailer.php');
require(ABSPATH . WPINC . '/class-smtp.php');
// date_default_timezone_set( 'America/Sao_Paulo' );
$blogname = wp_strip_all_tags( trim( get_option( 'blogname' ) ) );
$smtpHost = wp_strip_all_tags( trim( get_option( 'smtp_host' ) ) );
@timba64
timba64 / gitignore-for-wp
Created July 16, 2021 17:39 — forked from samhotchkiss/gitignore-for-wp
Basic Gitignore for WordPress
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@timba64
timba64 / sql_query_levelchinese.txt
Created April 25, 2019 07:16
Some sql gueries for memory
1. ********* step 1
CREATE TABLE `levelchinese`.`temp_usermeta` (
`umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`meta_key` varchar(255) DEFAULT NULL,
`meta_value` longtext,
PRIMARY KEY (`umeta_id`),
KEY `user_id` (`user_id`),
KEY `meta_key` (`meta_key`(191))
@timba64
timba64 / kinsta-share-users.php
Created April 24, 2019 06:56 — forked from carlodaniele/kinsta-share-users.php
A plugin to share users and usermeta tables between independent WordPress installations. This plugin requires CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE defined into wp-config file
<?php
/**
* @package Kinsta_Share_Users
* @version 1.0
*/
/*
Plugin Name: Kinsta Share Users
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin for Kinsta blog readers
Author: Carlo Daniele
@timba64
timba64 / indo_favicon.html
Created January 12, 2019 14:37
рекомендованная фавиконка
<!-- Стандартный фавикон -->
<link rel="icon" type="image/x-icon" href="https://example.com/favicon.ico">
<!-- Рекомендованный формат фавикона -->
<link rel="icon" type="image/png" href="https://example.com/favicon.png">
@timba64
timba64 / code.js
Last active November 26, 2018 09:24
Create custom menu in google spreadsheet, get unread email from google account and put it in google sheets
function onOpen(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Меню для Оли",
[{ name: "Write to file", functionName: "writeToFile" },
{ name: "Remove Duplicates", functionName: "removeDuplicates" },
{ name: "Count lids", functionName: "countLids" }]
);
}
/**
@timba64
timba64 / pie.js
Created October 30, 2018 14:29
Using Enhansed Ecommerce in Google Analytics
// get elements and push click in google Analitics
(function(){
var elems = document.querySelectorAll('.wcat-item');
for (var i = 0; i < elems.length; i++) {
elems[i].addEventListener('click', function(e){
var elName = this.querySelector('.name').textContent;
var elId = this.querySelector('.name').getAttribute('data-id');
var elPrice = parseInt(this.querySelector('.woocommerce-Price-amount').textContent);
//e.preventDefault();
dataLayer.push({