models.py
class MyUser(AbstractUser):
idstaff = models.CharField(max_length=255)
class Meta:
db_table = 'myuser'
swappable = 'AUTH_USER_MODEL'| module.exports = function(Vue) { | |
| Vue.directive('auto-bottom', { | |
| update: function() { | |
| this.el.scrollTop = this.el.scrollHeight; | |
| } | |
| }) | |
| }; |
| const EXEC_HEADER_LEN = 8; | |
| const EXEC_HEADER_STREAM_LEN = 4; | |
| const EXEC_HEADER_SIZE_LEN = 4; | |
| function excludeDockerExecHeader(buffer) { | |
| if (buffer.length <= EXEC_HEADER_LEN) { | |
| return ""; | |
| } | |
| let bodyLength = buffer.readUInt32BE(EXEC_HEADER_STREAM_LEN, EXEC_HEADER_SIZE_LEN); |
| from functools import wraps | |
| class MemGen: | |
| def __init__(self, generator): | |
| self.generator = generator | |
| self.mem = [] | |
| self.__doc__ = generator.__doc__ | |
| def __iter__(self): |
| reserved_names = { | |
| 'about', | |
| 'abuse', | |
| 'account', | |
| 'accounts', | |
| 'activity', | |
| 'admin', | |
| 'administrator', | |
| 'administrators', | |
| 'admins', |
| class ChoicesEnum(Enum): | |
| def __str__(self): | |
| return self.value | |
| @classmethod | |
| def choices(cls): | |
| return tuple( | |
| (item.value, item.name.replace('_', ' ').title()) for item in cls | |
| ) |
| /** | |
| * > if foo: | |
| * > | <= The cursor is here and hit delCharOrIndent command, it willbe | |
| * > | <= here | |
| * | |
| * This command will delete at most 4 spaces before, if text before charactor is all spaces. | |
| * If not on the case, this command will delete charactor as usual. | |
| */ | |
| (function(mod) { |
models.py
class MyUser(AbstractUser):
idstaff = models.CharField(max_length=255)
class Meta:
db_table = 'myuser'
swappable = 'AUTH_USER_MODEL'| toJson() { | |
| return JSON.stringify(this, (key, value) => { | |
| if (key == 'parent') { | |
| return value.id; | |
| } else { | |
| return value; | |
| } | |
| }); | |
| } |
| ;; Moving start line and start indend by C-a | |
| (defun back-to-indentation-or-beginning () (interactive) | |
| (if (= (point) (progn (back-to-indentation) (point))) | |
| (beginning-of-line))) | |
| (global-set-key "\C-a" 'back-to-indentation-or-beginning) |
| import statistics | |
| class Field: | |
| def __init__(self, field, agg_func=lambda l: l[0]): | |
| self.field = field | |
| self.agg_func = agg_func | |
| def aggregate(self, l): | |
| return self.agg_func(l) |