Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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;