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
function generateSnils() { | |
let snilsText; | |
let hash; | |
let leadZero = hash => (hash < 10 ? '0' : '') + hash; | |
function calculateSnilsHash(snils){ | |
let snilsTextNumbers = snils.replace(/\D/g,''); | |
if (!snilsTextNumbers.match(/^\d{9}/)) return -1; |
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 => false|true | |
function validationSnils(snils) { | |
var leadZero = function(hash) { | |
var hashNumber = Number(hash); | |
return (hashNumber < 10 ? '0' : '') + hashNumber; | |
} | |
// input :: "111-111-111 11" => "11111111111" | |
var snilsTextNumbers = snils.replace(/\D/g,''); |
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
'•'.charCodeAt().toString(16) // HTML::(•) CSS::(\2022) | |
String.fromCharCode(0x2022); // '•' |
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
function rgb2hex(rgb = 'rgba(1, 155, 255)') { | |
return rgb.match(/(\d+)/ig).reduce((result, item) => { | |
return result += ('0' + parseInt(item,10).toString(16)).slice(-2); | |
}, '#') | |
} | |
rgb2hex() // "#019bff" |
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
div { | |
width: 400px; | |
height: 400px; | |
margin: 100px auto; | |
border: 1px solid #000; | |
position: relative; | |
} | |
img { | |
position: absolute; |
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
function Todo(title, completed = false) { | |
let object = {}; | |
object.__proto__ = Todo.prototype; | |
this = object; | |
return this; | |
} |
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
const TodoList = (function() { | |
/* | |
* todos[{id, title, completed}, ...] | |
*/ | |
let todos = []; | |
return class { | |
constructor() { | |
this.init(); | |
} |
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
npm view typescript versions --json |
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
function whichTransitionEvent(){ | |
var t, | |
el = document.createElement("fakeelement"); | |
var transitions = { | |
"transition" : "transitionend", | |
"OTransition" : "oTransitionEnd", | |
"MozTransition" : "transitionend", | |
"WebkitTransition": "webkitTransitionEnd" | |
} |
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
if (old_key !== new_key) { | |
Object.defineProperty(o, new_key, Object.getOwnPropertyDescriptor(o, old_key)); | |
delete o[old_key]; | |
} |