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
window.open('http://ravenfox.ru', 'FuckYeah', 'width=500, height=300,resizable=no,scrollable=no,directiries=no,location=no,toolbar=no,menubar=no,status=no') |
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 writeFile(content, name) { | |
name = name || 'filename.txt'; | |
var a = document.createElement('a'); | |
a.hidden = ''; | |
a.href = 'data:text/json,' + encodeURIComponent(content); | |
a.download = name; | |
a.textContent = 'Download file '+name+'!'; | |
console.log(a); | |
document.body.appendChild(a); | |
} |
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
// Разделение разрядов числа пробелами. | |
var str = 'Lorem ipsum 234456234 Lorem ipsum 7345287346 asdfae'; | |
str.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 '); |
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
#Extract method from object | |
# Положим в ПЕРЕМЕННУЮ slice ФУНКЦИЮ slice из прототипа объекта Array | |
slice = Array.prototype.slice | |
# Используем call или apply, чтобы предоставить контекст (this) для функции slice | |
slice.call([1,2,3], 0, 1) # => [1] | |
slice.apply([1,2,3], [0,1]) # => [1] | |
# Т.к. call - это метод объекта Function, это значит, что контекстом метода call является вызывающая его функция |
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
window.loadScript = function (url) { | |
var script = document.createElement("script"); | |
script.src = url; | |
document.head.appendChild(script); | |
} | |
window.loadStyle = function (url) { | |
var link = document.createElement("link"); | |
link.href = url; | |
document.head.appendChild(link); |