Skip to content

Instantly share code, notes, and snippets.

@reytech-dev
reytech-dev / Fix.md
Last active March 20, 2024 10:19
ZONE_CONFLICT: 'docker0' already bound to a zone
  1. Check if docker zone exists in firewall-cmd
$ firewall-cmd --get-active-zones
  1. If "docker" zone is available, change interface to docker0 (not persisted)
$ sudo firewall-cmd --zone=docker --change-interface=docker0
  1. If "docker" zone is available, change interface to docker0 (persisted, thanks rbjorklin)
@brutus
brutus / migrate_collation.py
Created June 30, 2017 14:51
Converts the collation and character set of a database using a Django migration.
"""
Converts the *collation* and *character set* of a database using a Django
migration. Data in the tables is converted if needed.
"""
from django.db import migrations
def get_conversion_function(collation, character_set='utf8'):
@jonatanrdsantos
jonatanrdsantos / magento-groupby.md
Created December 17, 2015 13:47
Magento: Wrong count in admin Grid when using GROUP BY clause, overriding lib module

Magento when you use GROUP BY clause in any Grid.php file in admin, the count always display wrong. Many times it displays 1 even if there are hundreds of records. Due to this your pagination also doesn’t work. This is a bug in Magento. Your getSize() always returns wrong count whereas total records in grid are proper.

To fix this, you need to edit one of your core file. As it’s not a good practice to edit core file, we will here override the core file. Overriding LIB module

Create a rewrite to yout collection main.table:

Mage_[MODULE]Model_Resource[RESOURCENAME]_Grid_Collection

And rewrite getSelectCountSql function with below one:

@wesrice
wesrice / AbstractEntity.php
Last active August 4, 2021 22:02
Self Validating Value Objects and Entities (Laravel Implementation)
<?php
abstract class AbstractEntity extends AbstractValueObject
{
/**
* Offset Set
*
* @param mixed $offset
* @param mixed $value
*