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
//by Denys Pysmennyi | |
function perform() { | |
//TODO implement | |
} | |
perform(20, function(value) { | |
console.log(value) // 20 | |
var param = 1; | |
console.log(param); // 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
heroku login | |
heroku create | |
// heroku config:set NPM_CONFIG_PRODUCTION=false | |
git push heroku master | |
heroku open |
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'; | |
/** | |
* Double Cola | |
* | |
* Шелдон, Леонард, Пенни, Раджеш и Говард стоят в очереди к автомату по продаже баночек с напитком «Double Cola», | |
* других людей в очереди нет. Первый в очереди (Шелдон) покупает баночку, выпивает ее содержимое и раздваивается! | |
* Получившиеся два Шелдона встают в конец очереди. Затем следующий в очереди (Леонард) покупает баночку, | |
* выпивает и встает в конец очереди в двойном экземпляре, и так далее. Этот процесс продолжается до бесконечности. | |
* |
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'; | |
/** | |
* Красивый год | |
* | |
* А знали ли Вы забавный факт о том, что 2013 год является первым годом после далекого 1987 года, | |
* в котором все цифры различны? | |
* | |
* Теперь же Вам предлагается решить следующую задачу: задан номер года, найдите наименьший номер года, | |
* который строго больше заданного и в котором все цифры различны. |
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'; | |
/** | |
* Слишком длинные слова | |
* | |
* Иногда некоторые слова вроде «localization» или «internationalization» настолько длинны, | |
* что их весьма утомительно писать много раз в каком либо тексте. | |
* | |
* Будем считать слово слишком длинным, если его длина строго больше 10 символов. | |
* Все слишком длинные слова можно заменить специальной аббревиатурой. |
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'; | |
/** | |
* Выборы | |
* | |
* В стране Бялечинск начались выборы президента, в которых участвуют n кандидатов. | |
* Страна состоит из m городов. Известно, сколько человек в каждом городе проголосовало за каждого кандидата. | |
* | |
* Система выборов в стране имеет необычный вид. На первом этапе выборов подводятся итоги голосованя по городам: | |
* считается, что в городе победил тот кандидат, за которого было отдано наибольшее количество голосов в этом городе, |
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'; | |
/** | |
* cAPS lOCK | |
* | |
* зАЧЕМ НУЖНА КЛАВИША cAPS lOCK? | |
* Caps Lock — клавиша компьютерной клавиатуры, предназначенная для автоматической (постоянной) смены регистра | |
* букв со строчных на прописные. Будучи случайно нажатой, она приводит к последствиям вроде первого абзаца в | |
* условии этой задачи. | |
* |
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 tree = { | |
father: 'papa_0', mother: 'mama_0', children: [ | |
{ | |
father: 'papa_1_0', mother: 'mama_1_0', children: [ | |
{ | |
father: 'papa_2_0', mother: 'mama_2_0', children: [ | |
{ | |
father: 'papa_3_0', mother: 'mama_3_0', children: [] | |
}, | |
{ |
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
document.querySelector('body').innerHTML = '<div class="red"><div class="blue"><div class="green"></div></div></div><style>.red{background-color: red; width: 200px; height: 200px; padding-top: 50px; padding-left: 50px;} .blue{background-color: blue; width: 100px; height: 100px; padding-top: 50px; padding-left: 50px;} .green{background-color: green; width: 50px; height: 50px;}</style>'; | |
var red = document.querySelector('.red'), | |
blue = document.querySelector('.blue'), | |
green = document.querySelector('.green'); | |
red.addEventListener('click', function(event) { | |
console.log('red', event); | |
}); | |
blue.addEventListener('click', function(event) { | |
event.stopPropagation(); | |
console.log('blue', event); |
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 Animal() { | |
} | |
Animal.prototype.drink = function() { | |
console.info('drink!'); | |
}; | |
function Cat(shortName, longName) { | |
this.longName = longName; |