Skip to content

Instantly share code, notes, and snippets.

@dkemper
dkemper / Application\Service\MemcachedStorageFactory.php
Last active January 27, 2021 18:59
Zend Framework 2 - Session Memcached Configuration with Failover
<?php
namespace Application\Service;
use Zend\Cache\Storage\Adapter\MemcachedOptions;
use Zend\Cache\Storage\Adapter\MemcachedResourceManager;
use Zend\Cache\StorageFactory;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Session\SaveHandler\Cache;
@vdboor
vdboor / patch_admin_permissions_list.py
Last active March 29, 2021 11:10
Patch Django admin to hide useless default permissions.Import this file somewhere in an `__init__.py` or `admin.py` file.
"""
Hide permission in the Django admin which are irrelevant, and not used at all.
"""
from django.contrib import admin
from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.contrib.auth.models import Group, User
class PermissionFilterMixin(object):
def formfield_for_manytomany(self, db_field, request=None, **kwargs):