This file contains hidden or 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 Field = function(selector){ | |
var el = document.querySelector(selector), | |
callback; | |
this.get = function() { | |
return el.value; | |
}; | |
this.set = function(val) { |
This file contains hidden or 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 age = 'think'; | |
switch (true) { | |
case (/think/g).test(age): | |
console.log("Think!"); | |
break; | |
default: | |
console.log("not found"); | |
break; | |
}; |
This file contains hidden or 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
({ | |
css: function(el, prop){ | |
/*return css-prop*/ | |
}, | |
ajax: function(options){ | |
/*make ajax-request*/ | |
}, | |
init: function(name){ | |
var cache = {}; | |
this.getCache = function(){ return cache }; |
This file contains hidden or 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
-- 1. Создаем временную таблицу с правильными записями | |
CREATE TABLE tmp_users | |
SELECT * FROM users AS u | |
GROUP BY u.login | |
HAVING COUNT(u.login) >= 1 | |
-- 2. Переносим данные из tmp_users в users | |
-- предварительно очистив users | |
INSERT INTO users | |
SELECT * FROM tmp_users |
This file contains hidden or 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
String.prototype.replaceAll = function(find, replace) { | |
if(typeof find === 'string') | |
return this.split(find).join(replace); | |
var str = this; | |
find.forEach(function(el, i){ | |
str = str.split(el).join(replace[i]); | |
}); |
NewerOlder