Сочетания клавиш для тех, кто хочет войти в IT и не только.
Содержание
const createLogger = (backgroundColor, color) => { | |
const logger = (message, ...args) => { | |
if (logger.enabled === false) { | |
return; | |
} | |
console.groupCollapsed( | |
`%c${message}`, | |
`background-color: ${backgroundColor}; color: ${color}; padding: 2px 4px;`, | |
...args |
TextMask.maskInput({ | |
inputElement: document.querySelector("input[name = cadastral_number]"), | |
mask: function(rawValue) { | |
var mask = [/\d/, /\d/, ":", /\d/, /\d/, ":"]; | |
var chunks = rawValue.replace(/\_/g, "").split(":"); | |
var i; | |
for (i = 0; (!chunks[2] || i < chunks[2].length) && i < 7; i++) { | |
mask.push(/\d/); | |
} |
A pattern for recursion with Promises - in this example, walking a directory structure.
readDirRecursive()
is called with a starting directory and will itself return a Promise
.readDir()
is called and passed starting directory to read from.getItemList()
as a Promise
, which in turn is chained to getItemListStat()
to stat each item to determine if file or directory.processItemList()
:<!DOCTYPE html> | |
<html><head><meta charset="UTF-8"> | |
<title>HTML5 notepad app</title> | |
<meta charset="utf-8"> | |
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> | |
<style> | |
html,body{background:#FCFCFC;color:#444;height:100%;width:100%;margin:0;padding:0;} | |
#notepad{height:98%;width:98%;padding:1%;font-size:100%;line-height:125%;font-family:san-serif} | |
::selection{background:#7D7} | |
::-moz-selection{background:#7D7} |