This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES5 | |
var Element = (function() { | |
function Element() { | |
this._class = null; | |
} | |
Object.defineProperty(Element.prototype, 'className', { | |
get: function() { | |
return this._class; | |
}, | |
set: function(name) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Commit hook to add a JIRA ticket reference as a prefix to any commit messages. | |
# NOTE: JIRA ticket number MUST be included in branch name or it does nothing... | |
# Doesn't make any specific checks, just does it. | |
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //') | |
REGEX_TICKET_ID='(SOFT-[0-9]{4})' # SOFT can be replaced by any JIRA team name | |
# Do the regex search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ...... other BaseModel code | |
/** | |
* Recursively serialize properties through class getters | |
* Returns ready object for JSON.stringify() | |
*/ | |
public toJSON(): any { | |
const proto = Object.getPrototypeOf(this); | |
const jsonObj = { | |
[BaseModel.umt]: proto.constructor.universalModelType() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tracker { | |
_servers = []; | |
/** | |
* | |
* @param {string} hostType | |
* @example | |
* allocate("south") | |
*/ | |
allocate(hostType) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------- | |
TMUX CHEATSHEET | |
----------------- | |
Prefix for commands and help: | |
Ctrl-b and sth: issue a command to tmux, inside tmux. | |
Ctrl-b and ?: see all commands. | |
------------------------------------------------------------------- | |
Session commands: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { validate } from 'class-validator'; | |
const validationErrors = await validate(objInstance); | |
if (validationErrors.length > 0) { | |
throw new BadRequestException( | |
validationErrors.map( | |
({ property, constraints }) => | |
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | |
`${property}: ${Object.values(constraints!)[0]}`, |
OlderNewer