Skip to content

Instantly share code, notes, and snippets.

View ZeroICQ's full-sized avatar
🤖
Working from home

Alexey Mogilyovkin ZeroICQ

🤖
Working from home
View GitHub Profile
@yovko
yovko / ohmyzsh.md
Last active April 17, 2024 22:07
ZSH (using Oh My ZSH) on Manjaro Linux

ZSH (using Oh My ZSH) on Manjaro Linux

0. If ZSH is not already installed on your Manjaro system you can do it with the command:

sudo pacman -Syu zsh

You do not need to install manjaro-zsh-config and all the other related packages like zsh-syntax-highlighting, zsh-history-substring-search, zsh-autosuggestions, etc., as we will use Oh My Zsh.

@Susensio
Susensio / property_inheritance.md
Last active April 19, 2024 00:42
Inherit property setter in python 3.7

Python @property inheritance the right way

Given a Parent class with value property, Child can inherit and overload the property while accessing Parent property getter and setter.

Although we could just reimplement the Child.value property logic completely without using Parent.value whatsover, this would violate the DRY principle and, more important, it wouldn't allow for proper multiple inheritance (as show in the example property_inheritance.py bellow).

Two options:

  • Child redefines value property completely, both getter and setter.
@benctamas
benctamas / proxy_model_queryset.py
Created July 11, 2012 00:18
django - heterogeneous proxy model based queryset
from django.db import models
from django.db.models.query import QuerySet
from django.utils.functional import memoize
_class_mapper_cache = {}
def class_mapper(model):
proxy_for = model._meta.proxy_for_model or model
mapper = dict([ (getattr(m, m.CLASS_MAP_ATTR), m) for m in models.get_models() if issubclass(m, proxy_for) and m != proxy_for])
return mapper