Skip to content

Instantly share code, notes, and snippets.

View XOP's full-sized avatar

Evgeny Khoroshilov XOP

View GitHub Profile
/**
* From
* http://davidwalsh.name/document-readystate
*/
// The basic check
if(document.readyState === 'complete') {
// good to go!
}
@XOP
XOP / yac2014_frontend_review.md
Created November 5, 2014 13:26
Front-end track of Yandex Conference 2014

Front-end track of Yandex Conference 2014

DISCLAIMER:
The whole content comes "as is".
All commentaries refer to author's impression.

the official site and front-end track schedule

Needless to say, this year was different for Yandex and all attendees. The chosen format of conference is controversial, I've met different POVs on this term. So, basically, talks were 15 minutes length tops, not to mention they contained some axioms, assumptions, facts and numbers, pictures and (almost) no code at all.
What's made me smile - this year previously exaggerated value of BEM came to the desired level, letting other stuff out of it's shadow

@XOP
XOP / ssh-agent.md
Created November 18, 2014 14:27
SSH agent init
	SSH_ENV=$HOME/.ssh/environment
	   
	# start the ssh-agent
	function start_agent {
	    echo "Initializing new SSH agent..."
	    # spawn ssh-agent
	    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
	    echo succeeded

chmod 600 "${SSH_ENV}"

@XOP
XOP / css-selectors.scss
Created November 18, 2014 15:38
funky yet useful css selectors
//
// SCSS for convenience
//
// self sibling
// usage: basically margins and other layout specifics
.element + .element {
}
@XOP
XOP / gpuRender.styl
Created April 9, 2015 16:12
GPU render stylus mixin
//
// render in separate layer
// hack to balance CPU/GPU load
// usage gpuRender(chrome, mac-chrome)
gpuRender($browsers){
$i = 0;
$comma = ",";
$rule = "";
for $b in arguments {
@XOP
XOP / grabber.js
Last active August 29, 2015 14:26
collect hrefs, srcs, urls on the page
(function(undefined, body, selectors){
var collection = [];
var current;
for(var key in selectors){
current = body.querySelectorAll(selectors[key]);
current = [].slice.call(current);
current = current.map(function(i){ return i[key] });
@XOP
XOP / App.js
Created August 31, 2015 08:33
Include zepto in webpack bundle
/**
* App
*/
//
// only relevant code!
//
var $ = require('zepto');
//
@XOP
XOP / gulpfile.js
Created August 31, 2015 13:22
Gulp stream output iterator
//
// function
function iteratePaths(stream, start, finish, paths) {
paths.forEach(function (path) {
stream.pipe(gulp.dest(start + path + finish));
});
return stream;
}
//
@XOP
XOP / animation.css
Created September 20, 2015 14:04
Facebook feed preloader animation
.feed{
-webkit-animation-duration: 1s;
-webkit-animation-fill-mode: forwards;
-webkit-animation-iteration-count: infinite;
-webkit-animation-name: placeHolderShimmer;
-webkit-animation-timing-function: linear;
background: #f6f7f8;
background-image: -webkit-linear-gradient(left, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
background-image: linear-gradient(left, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
background-repeat: no-repeat;
function getArgs(func) {
// First match everything inside the function argument parens.
var args = func.toString().match(/function\s.*?\(([^)]*)\)/)[1];
// Split the arguments string into an array comma delimited.
return args.split(',').map(function(arg) {
// Ensure no inline comments are parsed and trim the whitespace.
return arg.replace(/\/\*.*\*\//, '').trim();
}).filter(function(arg) {
// Ensure no undefined values are added.