Skip to content

Instantly share code, notes, and snippets.

View CyrilKrylatov's full-sized avatar
💭
Fatigue as a life mantra

Cyril Krylatov CyrilKrylatov

💭
Fatigue as a life mantra
View GitHub Profile
import React from 'react';
import { SvgNavLeft, SvgNavRight } from './Svg';
const Component = () => (
<React.Fragment>
<SvgNavLeft fill="#F0F" />
<SvgNavRight />
</React.Fragment>
);
const srOnlyString = (string, limit, limiter) => {
if (string.length <= limit) {
return string;
}
const styles = {
position: 'absolute',
width: 1,
height: 1,
margin: -1,
<picture>
<source
media="(max-width: 979px)"
type="image/jpg"
srcset="
illu-telephone-center_mobile.png 1x,
illu-telephone-center_mobile@2x.png 2x
"
>
<source
[data-imgloaded] {
position: relative;
}
[data-imgloaded] > img[src^=data] {
transform: rotate(0);
-webkit-filter: blur(15px);
filter: blur(15px);
}
@CyrilKrylatov
CyrilKrylatov / bootstrap.less
Created June 4, 2015 17:22
diwi.com's bootstrap.less
// Core variables and mixins
@import "/vendor/bower/bootstrap/less/variables.less";
@import "/vendor/bower/bootstrap/less/mixins.less";
// Reset and dependencies
@import "/vendor/bower/bootstrap/less/normalize.less";
// @import "/vendor/bower/bootstrap/less/print.less";
// @import "/vendor/bower/bootstrap/less/glyphicons.less";
// Core CSS
@CyrilKrylatov
CyrilKrylatov / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
jQuery(document).ready(function() {
/*
Snippet from http://stackoverflow.com/a/5918791
*/
navigator.sayswho = (function(){
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
;(function(){
function createTransitionObject(transition) {
var obj = {
"-webkit-transition": transition,
"MozTransition": transition,
"OTransition": transition,
"transition": transition
}
@CyrilKrylatov
CyrilKrylatov / windowsheight.js
Last active December 12, 2015 02:59
TL;DR IE sucks as hell How to get windows height that will be compatible with all the majors browsers ?
var getWindowHeight = function() {
if (typeof(window.innerWidth) == 'number') {
windowHeight = window.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
windowHeight = document.documentElement.clientHeight;
}
return windowHeight;
};
@CyrilKrylatov
CyrilKrylatov / gist:4593141
Last active December 11, 2015 11:19
Truncate too long text
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Truncate code</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<style type="text/css">
* {
margin:0;padding:0;
}