Skip to content

Instantly share code, notes, and snippets.

// clear docker volumes and start with clean page
docker-compose down
docker rm -f $(docker ps -a -q)
docker volume rm $(docker volume ls -q)
docker-compose up -d
export const leftTrim = (string) => {
if (!string) return string;
return string.replace(/^\s+/g, '');
}
export const rightTrim = (string) => {
if (!string) return string;
return str.replace(/\s+$/g, '');
}
@v-vashchenko
v-vashchenko / Common-Currency.json
Created July 5, 2019 07:54 — forked from ksafranski/Common-Currency.json
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
const pattern = /^\d{0,4}(\.\d{0,4})?$/;
console.log('@@@MATCH', pattern.test(text));
@v-vashchenko
v-vashchenko / gist:feb781e79b4bd696a8f3dd86e7f5857c
Last active June 3, 2019 10:03
Migration extend enum postgres SEQUELIZE
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.changeColumn(
'table',
'column',
{
type: Sequelize.TEXT,
}
const getInitialModalState = () => ({
projects: {},
modalCreate: false,
modalAskForDelete: false,
currentId: 0,
currentDescription: '',
currentStart: defaultDate,
currentEnd: defaultDate,
currentDate: defaultDate,
currentTitle: 'Добавить переработку',
//custom textInput filter.
function setInputFilter(textbox, inputFilter) {
["input", "keydown", "keyup", "mousedown", "mouseup", "select", "contextmenu", "drop"].forEach(function (event) {
textbox.addEventListener(event, function () {
if (inputFilter(this.value)) {
this.oldValue = this.value;
this.oldSelectionStart = this.selectionStart;
this.oldSelectionEnd = this.selectionEnd;
const logRequestStart = (req, res, next) => {
console.log('\x1b[33m%s\x1b[0m', `${req.method} ${req.originalUrl}`)
res.on('finish', () => {
console.log(`${res.statusCode} ${res.statusMessage}; ${res.get('Content-Length') || 0}b sent`)
})
next()
}
document.removeEventListener("keydown", this.handleEscapeButton, false);
handleEscapeButton = (event) => {
if (event.keyCode === 27) {
this.setState({ openFilter: false });
}
};