Skip to content

Instantly share code, notes, and snippets.

View embarq's full-sized avatar
🕶️
Working hard

Li Ihor embarq

🕶️
Working hard
View GitHub Profile
export const HallOfFame = (function() {
/** @argument {Array<any>} players */
const sortPlayers = (players) => {
return players.slice().sort((a, b) => {
if (a.length !== 2 || b.length !== 2) {
console.log('[sortPlayers:except]', a, b);
return -1;
}
@Directive({
selector: '[openNextField]'
})
/**
* @example
* <form>
* <ion-list>
* <ion-item>
* <ion-label>Text field</ion-label>
* <ion-input [openNextField]="selectFieldRef"></ion-input>
@embarq
embarq / Descending Order.js
Last active June 18, 2018 12:50
JS basics
asd
[
{
"EN": "Afghanist",
"PT": "Afeganist",
"DE": "Afghanist",
"ISO Alpha 3-code": "AFG"
},
{
"EN": "Alban",
"PT": "Albân",

React Interview Questions

original

  1. What is React?
  2. What are the features of React?
  3. List some of the major advantages of React.
  4. What are the limitations of React?
  5. What is JSX?
  6. What do you understand by Virtual DOM? Explain its working.
class DIContainer {
diMap: {
[key: string]: any
}
initialDiMap: {
[key: string]: any;
}
add(_class) {
@embarq
embarq / paint.js
Last active February 5, 2018 04:34
const { PI } = Math;
class Toolbar {
constructor(toolbarId) {
const element = document.getElementById(toolbarId);
this.form = element;
this.value = null;
this.setValue();

Forms

Requirements:

  • When form control has one or more validation errors, print respective messages under input
  • When form control has invalid state, style its input, label and error message as invalid/danger.
  • When form control becomes valid, style its input and label as valid/successfull.
  • Each form has submit button. This button should be disabled until the form will have a valid value in it.

Login Page

@embarq
embarq / Blog.md
Last active January 26, 2018 16:45

Blog project

Part I: Project Init

Task

  1. Create Angular CLI project
  2. Copy sample-data.ts to src folder

Part I: Angular Template Syntax

Bootstrap setup in Angular CLI project

  1. Install bootstrap dependencies:
> npm install bootstrap jquery popper.js
  1. Add bootstrap styles, scripts and bootstrap dependencies(popper.js and jquery for ^4.0.0 version) to the .angular-cli.json. Assets paths should be relative to an app root(src by default)