Skip to content

Instantly share code, notes, and snippets.

View mistakster's full-sized avatar

Vladimir Kuznetsov mistakster

View GitHub Profile
@mistakster
mistakster / init Fotorama with html frames
Last active August 29, 2015 13:56
For the current project, I need Fotorama ( http://fotorama.io/ ) gallery with html frames. Fotrama perfectly handle such situations, but it prevents normal interaction within this frames. I found that I could suppress several events on html frames to bring expected user experience back.
$ele.fotorama()
.find(".fotorama__html")
.on("click mousedown MSPointerDown touchstart", function (e) {
e.preventDefault();
e.stopPropagation();
});
@mistakster
mistakster / environment.js
Created May 5, 2014 08:54
Wait for desired environment (mobile or desktop)
var Environment = (function () {
var _mqDesktop, _mqMobile;
function getMobileMediaQuery() {
return _mqMobile || (_mqMobile = window.matchMedia("(max-width: 719px)"));
}
function getDesktopMediaQuery() {
return _mqDesktop || (_mqDesktop = window.matchMedia("(min-width: 720px)"));
@mistakster
mistakster / index.html
Last active August 29, 2015 14:01
Gradient Performance Test
<!DOCTYPE html>
<html>
<head>
<title>Gradient Performance Test</title>
<style>
div {
height: 150px;
width: 1024px;
}
@mistakster
mistakster / cool-widget.css
Last active August 29, 2015 14:03
Example of the BEM-style mixins
.cool-widget {
position: relative;
}
.cool-widget__title {
font: bold 20px/1 sans-serif;
}
.cool-widget__body {
font: normal 14px/1.4 sans-serif;
color: white;
}
var os = require('os');
var fs = require('fs');
var mustache = require('mustache');
var config = require('./config/default.json');
var userConfig = {};
try {
userConfg = require('./config/' + os.hostname().toLowerCase() + '.json');
} catch (ex) {}
@mistakster
mistakster / args.js
Created December 27, 2014 13:44
Simple parser for command line arguments
var args = process.argv
.filter(function (p, i) {
return i > 1 && p.indexOf('--') == 0 && p.indexOf('=') > 0;
})
.reduce(function (out, p) {
var parts = p.match(/^--([^=]+)=(.*)$/);
out[parts[1]] = parts[2];
return out;
}, {});
@mistakster
mistakster / article.html
Created March 19, 2015 06:19
Markup using schema.org types
<html itemscope itemtype="http://schema.org/Article">
<head>
<title>Article 3</title>
</head>
<body>
<h1 itemprop="name headline">Article 3</h2>
<div itemprop="articleBody">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</body>
</html>
@mistakster
mistakster / gist:6cfdf78e65ba056f50f7
Created May 18, 2015 16:13
Gulp task to unwrap @media rules to make “mobile first” styles IE8 friendly.
var gulp = require('gulp');
var less = require('gulp-less');
var postcss = require('gulp-postcss');
var rename = require('gulp-rename');
var unwrapAtMedia = require('postcss-unwrap-at-media');
gulp.task('default', function () {
return gulp.src('./src/**/*.less')
.pipe(less())
.pipe(gulp.dest('./dist/'))
@mistakster
mistakster / FollowFriday_2015-07-10.md
Last active August 29, 2015 14:24
#FollowFriday list (2015-07-10)

Список #FollowFriday от 2015-07-10 по версии @jsunderhood

Ещё один энтузиаст React. Великолепно, что опыты Дэна @dan_abramov делают счастливыми не только его, но и нас.

Вячеслав @vslinko экспериментирует с React и не пишет в твиттер всяких глупостей. Только JS, только хардкор!

Любознательный разработчик Алексей @alexeyraspopov и его гитхаб https://github.com/alexeyraspopov

Ингвар @RReverser рассказывает по-английски про инструменты разработки JS-программиста

var express = require('express');
var router = express.Router();
router.use('/playlists', require('./playlists'));
router.use('/songs', require('./songs'));
module.exports = router;