@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) {| // IE | |
| // conditional comment | |
| (function(dom){ | |
| dom.innerHTML = '<!--[if IE]><br><![endif]-->'; | |
| return !!dom.firstChild.tagName; | |
| })(document.createElement('p')); | |
| // Conditional Compilation | |
| // http://msdn.microsoft.com/en-us/library/ahx1z4fs(VS.80).aspx |
| <?php | |
| /*! | |
| * HTML5 Cache Manifest Builder | |
| * @author Shen Junru | |
| * | |
| * in Command Line: | |
| * - remote=path (ex://domain/path/) | |
| * - path/type=remote (ex: ../js/*.js=/js) | |
| * in Browser: | |
| * - remote=path (ex://domain/path/) |
| <!DOCTYPE> | |
| <html> | |
| <head> | |
| <title>Center Element by CSS: inline-block</title> | |
| <style type="text/css"> | |
| html, body { | |
| width: 100%; | |
| height: 100%; | |
| margin: 0; | |
| padding: 0; |
| function strip_script(content, scripts, fix){ | |
| var so = 0, ss = 0, se, cs, ce; | |
| var save = Object(scripts) instanceof Array; | |
| while (-1 !== ( ss = content.indexOf('<script', ss) )) { | |
| // update comment range, if it is before the script | |
| while (null == ce || -1 !== ce && ss > ce) { | |
| if (-1 !== ( cs = content.indexOf('<!--', null == ce ? so : ce) )) { | |
| if (-1 === ( ce = content.indexOf('-->', cs) )) { | |
| // fix comment end tag |
| * { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| font-weight: normal; | |
| font-style: normal; | |
| text-decoration: none; | |
| color: black; | |
| cursor: default; | |
| } |
@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) {I hereby claim:
To claim this, I am signing this object:
| // https://www.textnow.com | |
| // https://www.google.com/voice/?setup=1#setup/ | |
| // node >= 8 | |
| // usage: node script.js "curl ..." | |
| const https = require('https'); | |
| const http = require('http'); | |
| const zlib = require('zlib'); | |
| const { URL } = require('url'); |
| // remove directory recursively | |
| const { promisify } = require('util'); | |
| const $fsys = require('fs'); | |
| const $path = require('path'); | |
| const fstat = promisify($fsys.stat); | |
| const lsdir = promisify($fsys.readdir); | |
| const mkdir = promisify($fsys.mkdir); | |
| const rmdir = promisify($fsys.rmdir); | |
| const unlink = promisify($fsys.unlink); |
| #!/bin/sh | |
| # file: node_modules/realm/scripts/download-realm.sh | |
| # cwd: node_modules/realm | |
| cd "$(dirname $0)/.." | |
| source ./dependencies.list | |
| VENDOR_DIR="vendor" | |
| LOCKFILE_NAME="download-realm.lock" | |
| NEW_CORE_SERVER_FOLDER="core/v${REALM_CORE_VERSION}" |