Skip to content

Instantly share code, notes, and snippets.

View OLDIN's full-sized avatar
🏠
Working from home

Vladyslav OLDIN

🏠
Working from home
View GitHub Profile
0x3a23F3F0bF7Bec6f418cde0f6B2F5019dA54c484
0x3a23F3F0bF7Bec6f418cde0f6B2F5019dA54c484
@OLDIN
OLDIN / rename_js_files.sh
Created May 8, 2018 15:42 — forked from afternoon/rename_js_files.sh
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@OLDIN
OLDIN / settings.js
Created July 16, 2018 07:50
MYSQL: delete item from json array
await db.config.update({
agents: db.sequelize.fn('JSON_REMOVE', db.sequelize.col('agents'), db.sequelize.fn('REPLACE', db.sequelize.fn('JSON_SEARCH', db.sequelize.col('agents'), 'one', req.params.agentName), '"', ''))
}, {
where: {
id: 1
}
});
@OLDIN
OLDIN / settings.js
Created July 16, 2018 07:51
MYSQL: add item to json array
await db.config.findOne({
attributes: [
[db.sequelize.where(db.sequelize.fn('JSON_SEARCH', db.sequelize.col('agents'), 'one', req.body.agentName), { $ne: null }), 'isExist']
],
where: {
id: 1
}
});
@OLDIN
OLDIN / tokens.md
Created July 28, 2018 11:01 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Preconditions:

В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с логином/паролем, сохранённым в базе данных пользователей.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

@OLDIN
OLDIN / README.md
Created December 18, 2018 14:43 — forked from twolfson/README.md
Quick and dirty database dump to S3 via Node.js

We are implementing database dumping which is straightforward but can be tedious to setup. Here's our setup:

  1. Create AWS user for db backups (e.g. db-backups-{{app}})
    • Save credentials in a secure location
    • If adding db scrubbing, use a separate user (e.g db-scrubs-{{app}})
  2. Create bucket for S3 access logging (e.g. s3-access-log-{{app}})
  3. Create consistently named bucket for db dumps (e.g. db-backups-{{app}})
    • Enable logging to s3-access-log-{{app}} with prefix of db-backups-{{app}}
  4. Add IAM policy for bucket access
  • Select user -> Choose "Add inline policy"

Angular Interview Questions

Some basic questions going from easy to difficult. A more exhaustive list of more questions from the community can be found here.

Easy

  • Whats the difference between components and directives? [ANSWER]: Components are widgets while directives more like decorators for elements and/or components.
  • How do you get a reference to a child component? [ANSWER]: ViewChild/ViewChildren or ContentChild/ContentChildren
  • What is the difference between ViewChild and ContentChild?
  • Whats the difference between NgModules and ES2015 Modules?
  • How do you lazy load components and why is lazy loading important?
  • Explain Observables and why they are useful.
@OLDIN
OLDIN / readme.md
Created March 3, 2020 17:55 — forked from navix/readme.md
Wait for all animations to finish before :leave in Angular 7 (@angular/animations)

Wait for all animations to finish before :leave in Angular 7

Including child components.

@Component({
  ...
  animations: [
    trigger('host', [
 transition(':enter, :leave', [