Skip to content

Instantly share code, notes, and snippets.

@AlexanderChev
AlexanderChev / cookies.js
Created October 14, 2017 18:56
CookiesJS
function setCookie(key, value, expiresDays) {
let dateToExpire = +Date.now() + expiresDays * 24 * 60 * 60 * 1000;
let formattedDatetoExpire = new Date(dateToExpire).toUTCString();
document.cookie = `${key}=${value}; expires=${formattedDatetoExpire}`;
}
@AlexanderChev
AlexanderChev / fontLocalStorage
Created September 23, 2017 17:02
fontLocalStorage
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@AlexanderChev
AlexanderChev / addMixin.js
Last active September 4, 2017 11:33
add mixin to prototype class
var extend = function (target) {
if (!arguments[1]) {
return;
}
for (var i = 1; i < arguments.length; i++) {
if (!target[prop] && source.hasOwnProperty(prop)) {
target.prototype[prop] = source[prop];
}
}
.bounceIn {
animation-name: bounceIn;
animation-duration: .5s;
animation-fill-mode: both;
}
@keyframes bounceIn {
from, 20%, 40%, 60%, 80%, to {
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
@mixin mobile-only {
@media (max-width: 768px) {
@content;
}
}
@mixin tablet-only {
@media (max-width: 1200px) {
@content;
}
html {
box-sizing: border-box;
height: 100%;
}
*, *:before, *:after {
box-sizing: inherit;
}
{
"extends": "eslint:recommended",
"env": {
"es6": true,
"node": true,
"browser": true
},
"ecmaFeatures": {
; http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = tab
indent_size = 4
end_of_line = lf
trim_trailing_whitespace = true
{
"rules": {
"color-hex-case": "lower",
"color-hex-length": "long",
"color-no-invalid-hex": true,
"font-family-name-quotes": "always-unless-keyword",
"font-family-no-duplicate-names": true,
"function-calc-no-unspaced-operator": true,
{
"tagname-lowercase": true,
"attr-lowercase": true,
"attr-value-double-quotes": true,
"attr-value-not-empty": false,
"attr-no-duplication": true,
"doctype-first": true,
"tag-pair": true,
"tag-self-close": false,
"spec-char-escape": true,