Skip to content

Instantly share code, notes, and snippets.

@LoyEgor
LoyEgor / media.less
Created February 14, 2017 17:43
mixin for easier @media use
@maxlg: ~"(max-width: 1199px)";
@maxmd: ~"(max-width: 991px)";
@maxsm: ~"(max-width: 767px)";
@maxxs: ~"(max-width: 320px)";
@minlg: ~"(min-width: 1200px)";
@minmd: ~"(min-width: 992px)";
@minsm: ~"(min-width: 768px)";
@mdtolg: ~"(min-width: 992px) and (max-width: 1199px)";
@smtomd: ~"(min-width: 768px) and (max-width: 991px)";
@smtolg: ~"(min-width: 768px) and (max-width: 1199px)";
@LoyEgor
LoyEgor / gulpfile.js
Created February 22, 2017 14:41
Archive.zip project
zip = require('gulp-zip'),
chmod = require('gulp-chmod'),
//zip compress files
gulp.task('zip', function() {
return gulp.src(['./{app,dist}/**/*', './gulpfile.js', './package.json'])
.pipe(chmod(0o755, 0o40755)) //fix permission on unix
.pipe(zip('Archive.zip'))
.pipe(gulp.dest('./'))
});
@LoyEgor
LoyEgor / clearfix.less
Created March 31, 2017 13:13
clearfix
//&:after{
.cfix() {
content: "";
display: table;
clear: both;
}
//}
@LoyEgor
LoyEgor / emmet
Created April 3, 2017 18:16
emmet snippet ul>li
ul>li*>a[href=$#.html]>{$#}
@LoyEgor
LoyEgor / gulpfile.js
Last active April 9, 2017 18:27
custom popup error report
//install
//npm i gulp-if gulp-notify gulp-plumber gulp-util
var gulpif = require('gulp-if');
var notify = require('gulp-notify');
var plumber = require('gulp-plumber');
var gutil = require('gulp-util');
//report error
var reportError = function(error) {
var report = '\n';
@LoyEgor
LoyEgor / gulpfile.js
Last active April 23, 2017 04:28
compress js
// install
// npm i gulp-concat gulp-uglify
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
// concat and clean js
gulp.task('compress:js', function () {
var jsjq = './app/js/jquery.min.js';
var jscore = './app/js/core.js';
var jsplug = './app/js/plugins.js';
@LoyEgor
LoyEgor / gulpfile.js
Last active April 23, 2017 04:29
html compressin settings
// install
// npm i gulp-htmlmin gulp-replace
var htmlmin = require('gulp-htmlmin');
var replace = require('gulp-replace');
//compress html
gulp.task('htmlmin', function() {
return gulp.src('app/**/*.html')
.pipe(htmlmin({
//Extrem compression//
@LoyEgor
LoyEgor / gulpfile.js
Last active April 23, 2017 11:23
inject html settings
//install
//npm i gulp-inject group-array@0.3.1
var inject = require('gulp-inject');
//inject html
gulp.task('inject:html', function() {
return gulp.src('./app/*.html')
.pipe(inject(gulp.src(['./app/template/*.html']), {
starttag: '<!-- inject:{{path}} -->',
relative: false, //if true inject:/app/template/menu.html, if false inject:template/menu.html
@LoyEgor
LoyEgor / .htaccess
Last active June 22, 2017 15:44
basic .htaccess (www redirect, gzip, 7 day changes)
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
FileETag MTime Size
<ifmodule mod_expires.c>
<filesmatch ".(jpg|gif|png|css|js|swf|svg|woff|woff2|ttf|eot)$">
ExpiresActive on
ExpiresDefault "access plus 7 day"
</filesmatch>
@LoyEgor
LoyEgor / package.json
Created June 22, 2017 15:53
basic package.json
{
"name": "new project",
"version": "0.0.0",
"description": "new project",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Loy Egor <loyegor@gmail.com> (http://loyegor.com/)",
"license": "ISC",