Skip to content

Instantly share code, notes, and snippets.

ur001 ur001

Block or report user

Report or block ur001

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ur001
ur001 / promise_queue.js
Last active Jun 27, 2019
Promise based Lock and Queue
View promise_queue.js
/**
* Асинхронная очередь с локами на чтение/запись
*/
class Queue {
constructor() {
this.queue = [];
this.readLock = new Lock();
this.writeLock = new Lock();
this.setEmpty();
}
@ur001
ur001 / decorators.py
Created May 28, 2014
Django models decorator for tracking fields changes
View decorators.py
def track_field_changes(only=None, exclude=()):
"""
Django models decorator for tracking fields changes
:only: fields to track for changes (all otherwise)
:exclude: fields to exclude from tracking
Adds to model instance:
get_old_value(field_name) — old value of given field
is_changed(field_name=None) — is any field (or given field) is changed
You can’t perform that action at this time.