@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).
Here we go with the explanations:
(function(x, f = () => x) {| // Определяем зависимости в переменных | |
| var gulp = require('gulp'), | |
| cache = require('gulp-cache'), | |
| clean = require('gulp-clean'), | |
| stream = require('event-stream'), | |
| size = require('gulp-size'), | |
| jshint = require('gulp-jshint'), | |
| concat = require('gulp-concat'), | |
| uglify = require('gulp-uglify'), | |
| minifyCSS = require('gulp-minify-css'), |
| #!/bin/bash | |
| # Enhanced version of https://stackoverflow.com/a/52371112/1835055 | |
| DIRNAME=${1:-.} | |
| cd $DIRNAME | |
| FILES=$(mktemp) | |
| PACKAGES=$(mktemp) |
| Here is my recipe how to speed up WebStorm: | |
| Go to Preferences and do next: | |
| Appearance & Behaviour > System Settings > Updates: disable auto update | |
| Appearance & Behaviour > System Settings > Using Statistics: Uncheck allowing sending data | |
| Editor > Live Templates: disable all, leave only what you are really use | |
| Editor > Emmet: disable all emmets | |
| Editor > Intentions: I leave only: CSS, Declaration, JavaScript and Language Injection | |
| Plugins: leave only next (* - can be also disabled in case don't need them): | |
| CoffeeScript * |
| /* | |
| Simple jQuery Curved Line Plugin for use with Google Maps Api | |
| author: Daniel Nanovski | |
| modifications: Coen de Jong | |
| version: 0.0.2 (Beta) | |
| website: http://curved_lines.overfx.net/ | |
| License: |
| function bulkRequest(urls) { | |
| const promises = urls.reduce((result, url) => { | |
| const isValidUrl = Object.prototype.toString.call(url) === '[object String]'; | |
| if (isValidUrl) { | |
| result.push( | |
| fetch(url) | |
| .catch(({ message }) => console.warn(`Bulk Request: ${ message }`)) | |
| .then(response => ({ [url]: response })) | |
| ) |
| 'use strict'; | |
| /* | |
| Instructions: | |
| 1 - Should execute 'npm run prepare' | |
| before the very first run, it will install and symlink all dependencies. | |
| 2 - Choose between production 'npm start' and development 'npm run start-dev' modes | |
| (watcher will run immediately after initial run). |
| const modifier = type => item => Object.prototype.toString.call(item) === `[object ${type}]`; | |
| const checkTypes = ['String', 'Function', 'Number', 'Boolean', 'Object', 'Symbol']; | |
| const is = checkTypes.reduce((checkers, type) => ({ ...checkers, [type]: modifier(type) }), {}); | |
| is.Function(null) |
| function structuralClone(obj) { | |
| return new Promise(resolve => { | |
| const {port1, port2} = new MessageChannel(); | |
| port2.onmessage = ev => resolve(ev.data); | |
| port1.postMessage(obj); | |
| }); | |
| } | |
| var obj = {a: 1, b: { | |
| c: b |
@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).
Here we go with the explanations:
(function(x, f = () => x) {| const EXTENSION_TYPE = { | |
| 0x01: 'PlainText', | |
| 0xF9: 'GraphicControl', | |
| 0xFE: 'Comment', | |
| 0xFF: 'Application' | |
| }; | |
| /** | |
| * Returns total length of data blocks sequence | |
| * |