Skip to content

Instantly share code, notes, and snippets.

View Igloczek's full-sized avatar

Bartek Igielski Igloczek

  • Bielsko-Biała, Poland
  • 06:51 (UTC +01:00)
  • X @igloczek
View GitHub Profile
@Igloczek
Igloczek / gulpfile.js
Last active September 10, 2015 19:33
Sample Gulp config
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var print = require('gulp-print');
var notify = require("gulp-notify");
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var csslint = require('gulp-csslint');
var autoprefixer = require('gulp-autoprefixer');
var uglify = require('gulp-uglify');
var browserSync = require('browser-sync');
@Igloczek
Igloczek / fontloader.phtml
Created August 28, 2015 15:43
Localstorage font loader with WOFF2 support and fallback to older browsers (like IE8)
<!--[if !IE]><!-->
<script type="text/javascript">
var supportsWoff2 = (function(){
if(!('FontFace' in window)){
return false;
}
var f = new window.FontFace( "t", 'url("data:application/font-woff2,") format("woff2")', {});
f.load().catch(function(){});
return f.status === 'loading';
})();
@Igloczek
Igloczek / .eslintrc
Last active September 9, 2015 12:40
ESLint config file
env:
node: true
browser: true
amd: true
es6: true
jquery: true
prototypejs: true
rules:
indent: 0
brace-style: [2, "1tbs"]
@Igloczek
Igloczek / unload.js
Created April 9, 2016 13:49
Cool way to fadeout page before loading next view
window.addEventListener("beforeunload", function () {
document.body.classList.add("animate-out");
});
@Igloczek
Igloczek / theme-inheritance.js
Created June 8, 2016 14:25
Frontools theme inheritance temporary workaround
module.exports = function() {
// global vars
var gulp = this.gulp,
plugins = this.opts.plugins,
config = this.opts.configs;
// local plugins
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
@Igloczek
Igloczek / bemed-clean.phtml
Last active January 5, 2021 10:57
Example of use BEM methodology in Magento 2
<form class="form">
<h2 class="form__header"></h2>
<p class="form__description"></p>
<div class="form__field field">
<label class="field__label"></label>
<input class="field__input">
</div>
<div class="form__field field">
<label class="field__label"></label>
<input class="field__input">
@Igloczek
Igloczek / index.js
Created March 5, 2017 12:20
Extremely simple CSS specificity analyzer
const css = require('css'),
fs = require('fs'),
specificity = require('specificity');
function getSelectorsWithHighSpecificity(cssFilePath, maxSpecificity) {
const cssFile = fs.readFileSync(cssFilePath, 'utf8'),
output = [];
css.parse(cssFile).stylesheet.rules.forEach(rule => {
if (rule.type === 'rule') {
@Igloczek
Igloczek / domready.js
Created April 5, 2017 21:12
DOM Ready event
window.domReady = function(callback) {
var ready = false;
var detach = function() {
if(document.addEventListener) {
document.removeEventListener("DOMContentLoaded", completed);
window.removeEventListener("load", completed);
}
else {
document.detachEvent("onreadystatechange", completed);
@Igloczek
Igloczek / README.md
Created May 19, 2018 11:46
Quick way to capitalize bunch of file names

Remeber to use git config core.ignorecase false while you are on case insensitive partition

@Igloczek
Igloczek / replace.js
Created May 21, 2018 14:25
Vue mixin object from component
const glob = require('glob')
const fs = require('fs')
glob('core/components/**/*.js', (temp, files) => {
files.forEach(path => {
// const file = require('./' + path)
console.log(path)
let file = fs.readFileSync('./' + path, 'utf8')
file = file.replace(/import Vue from 'vue'\n/gm, '')