This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const add = (a,b) => a+b; | |
function memo (fn) { | |
let args = []; | |
function result(a,b) { | |
let hasMemo = args.reduce((acc, i) => { | |
if(i.a === a && i.b === b) { | |
return i; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Counter { | |
constructor(i = 0) { | |
// this.counter = 999 | |
this._count = i | |
} | |
addOne() { | |
this._count++ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear() //just clear console | |
//any instantinated dog should bark somehow | |
interface IBark { | |
bark: (param: any) => string | |
} | |
// abstract for class means, class should be extended, not instantinated | |
abstract class AbstractDog implements IBark { | |
private weight: number = 15; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.odd = function () { | |
return this.filter(i => i%2 === 1) | |
} | |
console.log([1,2,3,4,5,6].odd()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kill all running containers with docker kill $(docker ps -q) | |
delete all stopped containers with docker rm $(docker ps -a -q) | |
delete all images with docker rmi $(docker images -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"sourceMap": true, | |
"noImplicitAny": false, | |
"module": "commonjs", | |
"target": "es5", | |
"jsx": "react", | |
"allowJs": true, | |
"allowSyntheticDefaultImports": true, | |
"experimentalDecorators": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mongoose from 'mongoose'; | |
import dotenv from 'dotenv'; | |
import { Readable } from 'stream' | |
let bucket; | |
const envConfig = dotenv.config(); | |
if (envConfig.error) { | |
console.log('.env file does not loaded'); | |
throw envConfig.error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
import './index.css' | |
function App() { | |
return ( | |
<div className="App"> | |
<Parent/> | |
</div> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Message { | |
//Важный момент что мы передадим айди, чтобы потом по этому айди можно было достать элемент | |
constructor(title, body, author, id) { | |
this.title = title; | |
this.body = body; | |
this.author = author; | |
this.id = id; | |
} | |
//функция отображения. По сути месседж знает о принадлежащих ему ансерах. И сначала выводиться меседж а потом |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AddWelcome = (GreetingComponent) => { | |
class TheNewComponent extends Component { | |
render() { | |
return ( | |
<div> | |
<GreetingComponent {…this.props}/> | |
<p>Welcome to React!</p> | |
</div>); | |
} | |
} |
NewerOlder