Skip to content

Instantly share code, notes, and snippets.

@LoyEgor
LoyEgor / init.coffee
Last active January 11, 2022 12:51
atom sync settings
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@LoyEgor
LoyEgor / gulpfile.js
Last active March 13, 2023 17:22
best image compression settings (gulp-imagemin)
// install
// npm i gulp-cache gulp-imagemin imagemin-pngquant imagemin-zopfli imagemin-mozjpeg imagemin-giflossy -f
// node node_modules/jpegtran-bin/lib/install.js
// node node_modules/gifsicle/lib/install.js
// node node_modules/zopflipng-bin/lib/install.js
// node node_modules/mozjpeg/lib/install.js
// node node_modules/giflossy/lib/install.js
// node node_modules/pngquant-bin/lib/install.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 / 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 / font-old.less
Last active July 16, 2017 17:41
mixin for easier custom font use
@fdir: '../fonts/';
@ff-name: 'CirceRoundedAlt';
@rg: '@{ff-name}-Regular1';
@bd: '@{ff-name}-Regular2';
.ff(@ff) {
font-family: e(replace(@ff, @ff-name, "cust-ff")), Arial, Helvetica Neue, Helvetica, sans-serif;
}
.ff-mix(@ff) {
@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 / gulpfile.js
Last active March 19, 2018 16:47
Real Favicon Generator Settings
// npm i gulp-real-favicon
var realFavicon = require('gulp-real-favicon');
var fs = require('fs');
// File where the favicon markups are stored
var FAVICON_DATA_FILE = 'faviconData.json';
// Generate the icons.
gulp.task('generate-favicon', function(done) {
@LoyEgor
LoyEgor / gulpfile.js
Last active June 22, 2017 17:08
gulp git settings
// install
// npm i gulp-bump gulp-git run-sequence
var bump = require('gulp-bump');
var git = require('gulp-git');
var runSequence = require('run-sequence');
var fs = require('fs');
// get project files
var allgit = ['./app/**/*', './gulpfile.js', './package.json', './faviconData.json'];
// get project version
// get project version
@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 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