This file contains hidden or 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
| function func (...arg) { | |
| return (init) => { | |
| return arg.reduce((res, fn) => { | |
| return fn(res) | |
| }, init); | |
| } | |
| } | |
| var summ = func((a) => a+1, (b)=> b+2,(c) => c+3)(2); |
This file contains hidden or 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 createStore = (reducer) => { | |
| let state; | |
| let listeners = []; | |
| const getState = () => state; | |
| const dispatch = (action) => { | |
| state = reducer(state, action); | |
| listeners.forEach(listener => listener()); | |
| } |
This file contains hidden or 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
| { | |
| "name": "webpack-workshop", | |
| "version": "1.0.0", | |
| "scripts": { | |
| "server": "node ./server/index.js", | |
| "build": "cross-env NODE_ENV=production webpack", | |
| "dev": "webpack-dev-server --hot --inline" | |
| }, | |
| "private": true, | |
| "devDependencies": { |
This file contains hidden or 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 getApiDataList { | |
| constructor (url, indexProp, sizeProp, options = {}) { | |
| this.options = options; | |
| this.indexProp = indexProp; | |
| this.sizeProp = sizeProp; | |
| this.mainUrl = new URL(url); | |
| this.params = new URLSearchParams(this.mainUrl.search); | |
| this._index = +this.params.get(this.indexProp); | |
| } |
This file contains hidden or 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
| language: node_js | |
| node_js: | |
| - 6 | |
| os: linux | |
| install: | |
| - yarn install | |
| script: | |
| - yarn test | |
| - yarn build | |
| cache: |
This file contains hidden or 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 http = require('http'); | |
| const PORT = Number(process.argv[2]) || 8080; | |
| const child_process = require('child_process'); | |
| const Routes = { | |
| BATTERY: /\/battery\/?/ | |
| }; | |
| const Status = { | |
| NOT_FOUND: 404, |
This file contains hidden or 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
| /** | |
| * Resolves a Promise after a specified amount of time. | |
| * | |
| * @param {number} delay Milliseconds to wait before resolving. | |
| * @param {any} value Argument to be resolved by this Promise. | |
| * | |
| * @return {Promise} Promise which will be resolved after passed time. | |
| * | |
| * @example | |
| * const delay = require('nanodelay') |
This file contains hidden or 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
| <!-- | |
| made under the impression of the idea - https://github.com/tc39/proposal-intl-plural-rules | |
| Writed by Andriy Ivashchenko | |
| --> | |
| <!DOCTYPE html> | |
| <html lang="ru"> | |
| <head> | |
| <meta charset="UTF-8"> |
This file contains hidden or 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
| // HTML5 input type=email regexp | |
| const emailRegexp = /^[a-zа-я0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zа-я0-9-]+(?:\.[a-zа-я0-9-]+)+$/i; | |
| console.log('--- ', emailRegexp.test('text@yandex.ru')); |
This file contains hidden or 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
| function fetchUserDetails(arr) { | |
| return arr.reduce(function(promise, elem) { | |
| return promise.then(function() { | |
| return db.getUser(email).done(function(res) { | |
| logger.log(res); | |
| }); | |
| }); | |
| }, Promise.resolve()); | |
| } |