Skip to content

Instantly share code, notes, and snippets.

View alx8437's full-sized avatar
👨‍💻

Aleksandr alx8437

👨‍💻
View GitHub Profile
Array.prototype.diff = function(a) {
return this.filter(function(i) {return a.indexOf(i) < 0;});
};
////////////////////
// Examples
////////////////////
[1,2,3,4,5,6].diff( [3,4,5] );
// => [1, 2, 6]
@alx8437
alx8437 / gitignore
Last active May 18, 2020 08:42
gitignore
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
import React from 'react';
class AddNewItemForm extends React.Component {
constructor() {
super();
}
state = {
error: false,
inputValue: ''
class App extends React.Component {
state = {
todolists: [],
};
newTodoListId = 0;
addTodoList = (title) => {
let newTodoList = {id: this.newTodoListId, title: title};
function greet(lang) {
return langs[lang]||langs['english'];
}
var langs = {
'english': 'Welcome',
'czech': 'Vitejte',
'danish': 'Velkomst',
'dutch': 'Welkom',
'estonian': 'Tere tulemast',
//Расширение объектных литералов
let name = "Alex"
let soname = "Zel"
let obj = {name, soname}
console.log(obj)
// Также можно создать метод
let fullName = function() {
import sound from "./source/filename.mp3"
let audio = new Audio(sound);
audio.play();
// Create interfaces for type
interface Urls {
small: string;
regular: string;
}
export interface PictureDate {
id: string;
urls: Urls;
(change)="showOptions($event)"
showOptions(event:MatCheckboxChange): void {
console.log(event.checked);
}
// component for output data
import {Component, OnInit} from '@angular/core';
import {PictureDate, PictureService} from '../../services/picture.service';
import {StateService} from '../../services/state.service';
@Component({
selector: 'app-home-page',
templateUrl: './home-page.component.html',