Skip to content

Instantly share code, notes, and snippets.

View ciases's full-sized avatar

Dmitry Pashkovets ciases

View GitHub Profile
@ciases
ciases / git-zip-changed-files.md
Last active March 23, 2024 16:37
Git: zip changed files + diff

GIT: zip changed files + diff

Create zip archive with changed files

git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)

or

@ciases
ciases / touch-device-detect.js
Created April 7, 2016 11:30
Detect touch device js snippet
if (!("ontouchstart" in document.documentElement)) {
document.documentElement.className += " no-touch";
}
@ciases
ciases / readme.md
Created April 11, 2016 14:03
Bootstrap Sass Installation and Customization

Bootstrap Sass Installation and Customization

  1. run bower install bootstrap-sass inside project root
  2. copy _variables.scss to sass forder, rename it to _customVariables.scss
  3. add imports to main.scss:
@import "customVariables";
@import "../bower_components/bootstrap-sass/assets/stylesheets/bootstrap";
@ciases
ciases / parallax-scroll.js
Created April 17, 2016 07:46
Easy parallax scroll effect
// https://bolt.cm/
// MAKE TOPIMAGE SCROLL SLOWER FOR PARALLAX EFFECT
$(window).scroll(function () {
$('header').css('backgroundPosition', '0px ' + (posTop() / 2) + 'px');
});
// FIX FOR SCROLLPOS IN ALL BROWSERS
function posTop() {
return typeof window.pageYOffset != 'undefined' ? window.pageYOffset: document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop? document.body.scrollTop:0;
@ciases
ciases / gulpfile.js
Created June 20, 2016 08:21
Gulp less error handling
'use strict';
var gulp = require('gulp');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync').create();
var rigger = require('gulp-rigger');
var autoprefixer = require('gulp-autoprefixer');
// variant 1: without `return`
@ciases
ciases / gulpfile.js
Created June 30, 2016 11:29
Gulp + BrowserSync (minimal config)
// Usage:
// $ npm install gulp browser-sync --save-dev
// $ gulp serve
'use strict';
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
gulp.task('serve', function() {
@ciases
ciases / button.html
Created July 26, 2016 09:19
Bootstrap input type file
<style>
.btn-file {
position: relative;
overflow: hidden;
}
.btn-file input[type=file] {
position: absolute;
top: 0;
right: 0;
min-width: 100%;
@ciases
ciases / convert.md
Last active September 2, 2016 08:56
Use ImageMagick to create optimised and progressive JPGs

Use ImageMagick to create optimised and progressive JPGs

Use the following command to optimise a JPG and make it progressive:

$ convert -strip -interlace Plane -quality 80 input-file.jpg output-file.jpg

Batch all the images in a folder like this:

$ for i in source/images/backgrounds/*.jpg; do convert -strip -interlace Plane -quality 80 $i $i; done
@ciases
ciases / svg-animation.html
Created October 13, 2016 14:26
SVG path animation
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
.path {
@ciases
ciases / image-optimization.md
Created January 25, 2017 08:32
Image optimization tools (online, offline)

There are also online tools which can help you optimize your pictures with loss of quality, by performing safe automatic tasks:

If you are at ease with command line tools, you can use these:

  • Pngnq: converts 24-bit PNG files into 6 to 8-bit ones, by only keeping the needed colors. Download: