Skip to content

Instantly share code, notes, and snippets.

View Broasca's full-sized avatar

Broasca Alexandru Broasca

View GitHub Profile
@bradtraversy
bradtraversy / docker-help.md
Last active June 28, 2024 04:54
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@mikaelz
mikaelz / delete-all-woocommerce-products.php
Last active April 30, 2024 06:07
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
@kbond
kbond / AppKernel.php
Last active March 6, 2020 19:10
JWT Authentication With Symfony Guard. POST username/password to /login to receive token, /api* requests require a valid token
<?php
// app/AppKernel.php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
public function registerBundles()
{
@zajca
zajca / CSVImportCommand.php
Created October 31, 2014 07:58
Symfony2 custom command for import CSV
<?php
namespace PRIA\QuizApiBundle\Command;
use PRIA\Bundle\UserBundle\EntityRepository\RoundsRepository;
use PRIA\QuizApiBundle\Entity\Answers;
use PRIA\QuizApiBundle\Entity\Questions;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@FlYos
FlYos / 1-Readme.md
Last active April 14, 2023 21:22
Redirection user by roles after login/logout in symfony2

Description of this Gist

This is the how to for redirection implementation by roles after login or logout in Symfony2

Step

  1. Copy AfterLoginRedirection.php and AfterLogoutRedirection.php to your bundle under the "Redirection" directory
  2. Edit your services.yml file in your bundle and copy/paste the content of services.yml
  3. Edit your security.yml file...
  4. ... add success_handler: redirect.after.login in form_login: section
  5. ... add success_handler: redirect.after.logout in logout: section