Skip to content

Instantly share code, notes, and snippets.

View tomasevich's full-sized avatar
❤️
TypeScript / JavaScript

Vyacheslav tomasevich

❤️
TypeScript / JavaScript
  • Russia, Krasnodar
View GitHub Profile
@tomasevich
tomasevich / mongod.md
Created August 14, 2019 11:25
mongo problems and resolves

Attempted to create a lock file on a read-only directory: /data/db, terminating

sudo chmod -R go+w /data/db

@tomasevich
tomasevich / README.md
Last active September 2, 2019 05:28
Vue + Vuex + Socket

Structure

.
├── client
│   ├── package.json (client_package.json)
│   ├── public
│   │   └── index.html (client_public_index.html)
│   ├── src
│   │   ├── components
@tomasevich
tomasevich / tltd.md
Last active November 23, 2019 06:40
[TLTD] - Type, Lint, Test & Docs (Best practice of JS development)

TLTD

Пишите код качественно, безопасно, внятно и красиво!

Томасевич В.С. @ 2019

Практика TLTD (Type, Lint, Test & Docs) - это подход, в котором написание кода на JavaSsript происходит "поэтапно".

Type

@tomasevich
tomasevich / .editorconfig
Created December 20, 2019 05:21
Editor config (for all files
root = true
charset = utf-8
[*]
tab_width = 4
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
@tomasevich
tomasevich / include.md
Created January 22, 2020 08:58
Better local require() paths for Node.js

Config

Add this global function to main entrypoint like index.js

global.include = prevPath => {
  const newPath = prevPath.replace('@', __dirname + '/')
  console.log(prevPath, '=>', newPath)

 return require(newPath)

VueJS + ExpressJS

Serve static files, exclude 404 error on backend

Make middleware

/* serve.js */
const path = require("path");
const express = require("express");
@tomasevich
tomasevich / autoInstall.js
Created September 25, 2018 08:00
Auto-install modules :)
'use strict'
const { exec } = require ('child_process')
try {
const express = require ('express')
const ejs = require ('ejs')
var app = express ()
app.listen (8080)
} catch (e) {
@tomasevich
tomasevich / README.md
Last active March 18, 2020 20:22
Админка БД (mongo)

Админка БД (mongo) - лучшая!

Ранее, я писал о админке для mongodb, но как оказалось, есть намного круче интерфейс.

Установка

  1. Устанавливаем пакет из оф.репозитория:
$ git clone https://github.com/mrvautin/adminMongo.git
@tomasevich
tomasevich / jsonFromUrl.md
Last active May 10, 2021 08:52
node js: read JSON file from URL like object
var request = require ('request')

request ({
	url: 'https://raw.githubusercontent.com/rateljs/plugin/master/package.json',
	json: true
}, (error, response, body) => {
	!error && response.statusCode === 200
		? log (body)
 : log (error)
@tomasevich
tomasevich / README.md
Last active September 29, 2021 13:01
.vscode