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
//helper function | |
export function $$(selector, context) { | |
context = context || document; | |
var elements = context.querySelectorAll(selector); | |
return Array.prototype.slice.call(elements); | |
} | |
export function convertToSnake (str) { | |
let strArr = str.split(''), | |
isLastUppercase = false; |
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 getRGB(hex){ | |
var res = 'rgb('; | |
if (hex.length === 7) { | |
res += parseInt(hex[1] + hex[2], 16) + ', '; | |
res += parseInt(hex[3] + hex[4], 16) + ', '; | |
res += parseInt(hex[5] + hex[6], 16) + ')'; | |
return res; | |
} else { | |
res += parseInt(hex[1]+ hex[1], 16) + ', '; | |
res += parseInt(hex[2] + hex[2], 16) + ', '; |
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
'use strict'; | |
let UA = navigator.userAgent, | |
isIos = /ip(hone|od|ad)/i.test(UA), | |
isSafari = /(mac os x).*version\/\d(.\d)+ (mobile\/\w{5,} )?safari/i.test(UA), | |
isSafari5 = /(mac os x).*version\/5[.\d]+ (mobile\/\w{5} )?safari/i.test(UA), | |
isAndroid = /android/i.test(UA), | |
isAndroidBrowser = isAndroid && !/chrome|firefox/i.test(UA), | |
isAndroidBrowserOld = isAndroidBrowser && parseFloat(/android ([\d\.]+)/i.exec(UA).pop()) < 4.3, | |
isAndroid2 = isAndroidBrowser && /android 2\.\d/i.test(UA), |
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 grid(container, columns) { | |
'use strict'; | |
var els = document.querySelectorAll(container); | |
[].forEach.call(els, function(el){ | |
var frag = document.createDocumentFragment(), | |
grid = document.createElement('div'), | |
cols = columns; | |
grid.style.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
'use strict'; | |
angular.module('app') | |
.factory('Flags', | |
function Flags() { | |
var exports = {}; | |
var UA = navigator.userAgent, | |
isIOS = /ip(hone|od|ad)/i.test(UA), | |
isSafari = /(mac os x).*version\/\d(.\d)+ (mobile\/\w{5,} )?safari/i.test(UA), | |
isSafari5 = /(mac os x).*version\/5[.\d]+ (mobile\/\w{5} )?safari/i.test(UA), |
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 class="wrap"> | |
<div class="cube"> | |
<div class="front">front</div> | |
<div class="back">back</div> | |
<div class="top">top</div> | |
<div class="bottom">bottom</div> | |
<div class="left">left</div> | |
<div class="right">right</div> | |
</div> | |
</div> |