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
/* What will be the console order. */ | |
function busy(duration) { | |
const current = Date.now(); | |
let future = Date.now(); | |
while (future - current < duration) { | |
future = Date.now(); | |
} | |
} |
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 colorsRegex = /(color|shadow|background|outline)\: [^(\$|inherit|transparent|\d|none|\-\.)]/g; |
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
module.exports = function ellipseRow(el) { | |
var maxLines = parseInt(el.getAttribute('max-rows'), 10); | |
var lineHeight = parseInt(getComputedStyle(el, null).getPropertyValue('line-height'), 10); | |
var padding = parseInt(getComputedStyle(el, null).getPropertyValue('padding'), 10); | |
var maxHeight = lineHeight * maxLines + 2 * padding; | |
var hiddenBrandCount = 0; | |
while (el.offsetHeight > maxHeight) { | |
hiddenBrandCount++; | |
el.textContent = el.textContent.substring(0, el.textContent.lastIndexOf(', ')); |
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
/* jQuery way */ | |
$('*') | |
.filter(function(){ | |
return !!$._data( this, 'events'); | |
}) | |
.get() | |
.reduce(function(dict, el){ | |
dict[el.className] = Object.keys($._data( el, 'events')).sort().join(', ') | |
return dict; | |
}, {}); |
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
function countRegex(value) { | |
var match = ('' + value).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); | |
if (!match) { | |
return 0; | |
} | |
return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0)); | |
} | |
function countParse(value) { | |
var data = parseFloat(value).toString().split('.'); |
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
'use strict'; | |
// npm install png-js https://github.com/devongovett/png.js | |
// npm install image-size https://www.npmjs.com/package/image-size | |
const options = process.argv.slice(2); | |
if (options.length < 3) { | |
throw 'Required arguments: filename, cell width, cell height. Optional 4th argument: row spacing.'; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Kalambury (filmy)</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<style type="text/css"> | |
body { | |
font-family: Verdana; |
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
let dirToRead = 'e:/tmp'; | |
let outputFile = 'e:/output.js'; | |
fs.readdir(dirToRead, function(err, data){ | |
if (err){ | |
return console.log(err); | |
} | |
fs.writeFile(outputFile, "[\n'"+data.join("',\n'")+"'\n]"); | |
}); |
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
(function(j, w) { | |
w.call(document.styleSheets).forEach(function(q) { | |
try { /* Accessing remote domain cssRules fails. */ | |
w.call(q.rules || q.cssRules).forEach(function(k) { | |
(k.selectorText || '').split(',').forEach(function(b) { | |
(b.length > j.length) && (j = b); | |
}); | |
}); | |
} catch (z) {} | |
}); |
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
/* jQuery plugin template | |
* Replace Plugin__Constructor with name of constructor function. | |
* Replace plugin__name with string name, used for namespacing events, data binding. | |
**/ | |
(function(Window, Document, $, factory) { | |
'use strict'; | |
var theModule = factory($, Document); |