Skip to content

Instantly share code, notes, and snippets.

View depoulo's full-sized avatar

Paolo Priotto depoulo

  • ePages GmbH
  • Hamburg, Germany
  • 00:26 (UTC +01:00)
  • X @depoulo
View GitHub Profile
@depoulo
depoulo / compare-html-bodys-with-branch.sh
Last active June 16, 2020 14:14 — forked from JonathanWbn/compare-html-bodys-with-branch.sh
Compare html bodys for different pages for Now and Beyond. Requires `yarn start` to be running with shops for `fatty` and `skinny`.
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'No branchname provided.'
exit 0
fi
themes=( editorial limelight neutral spotlight structure uptown vision )
fattyPages=( en p/apple-jam-with-gallery p/apple-jam-without-gallery p/t-shirt-includes-basic-product-type p/navy-shoes search search?q=* l/contact i/about-us c/category cart unknown )
skinnyPages=( i/home p/test-product p/neues-produkt p/product-with-video p/refrence-price-test-product-1 search search?q=prod l/contact i/about-us p/unknown i/unknown cart unknown checkout/personal-data checkout/shipping checkout/payment checkout/confirmation )
try {
document.body.innerHTML =
'<div id="sw-failure" style="z-index: 1; position: fixed; pointer-events: none">ServiceWorker failed</div>'
+ document.body.innerHTML
} catch (_err) {
console.log('Hello from ServiceWorker', String(registration))
}
if(window.eComEventTarget){window.eComEventTarget.addEventListener('order:completed',function(event){console.log('order completed:',event.detail)})}
@depoulo
depoulo / color-contrast.css
Last active December 18, 2018 10:07
The CSS4 contrast adjuster mimicked with just custom properties and calc(). Demo: https://codepen.io/depoulo/pen/WLGeQz
/*
The CSS4 contrast adjuster mimicked with just custom properties and calc().
While it's pretty straightforward to mimick the hue, saturation and
lightness adjusters, color contrast requires some "serious" math.
Results are not perfect, but very much usable IMHO.
Syntax of course is even more bloated than for the simple adjusters stated above.
*/
html::before {
/* A few demo styles. */
position: fixed;
@depoulo
depoulo / create-100kb-of-random-text.sh
Created May 24, 2018 12:23
Create 100kB of random text
# Windows (Git bash)
dd if=/dev/urandom of=tmp bs=100kB count=1 && base64 tmp > big && rm tmp && cat big > /dev/clipboard && rm big
# Mac OS
dd if=/dev/urandom of=tmp bs=100kB count=1 && base64 tmp > big && rm tmp && cat big | pbcopy && rm big
@depoulo
depoulo / MySQL-query-log.sql
Last active May 24, 2018 08:59
MySQL query logging
set global general_log = 1;
set global log_output = 'table';
--
select event_time, substring(argument,1,100) from mysql.general_log where event_time > time('08:58');
--
SET global general_log = 0;
@depoulo
depoulo / gist:d8c79e180b269b237803303122feee07
Last active June 20, 2016 08:51
Chrome Windows bug - sadly no issue number
Browser unresponsive when large amount of text is inside text input field.
1. Visit this page: data:text/html,<!doctype html><html style="min-height: 300vh"><input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" type="text"></input>
2. Paste a large amount of text (between 10k and 100k characters, depending on your machine) into the text input.
3. Try repositioning the cursor, or scrolling
=> You'll experience serious lag, whereas Chrome on Mac OS, as well as other browsers, are just fine.
@depoulo
depoulo / requireParams.js
Last active March 4, 2016 14:49
express middleware that throws if the specified request parameters are missing
import {difference} from 'lodash';
export function BadRequestError(message) {
this.name = 'BadRequestError';
this.statusCode = 400;
this.message = 'Bad request. ' + message;
}
BadRequestError.prototype = Object.create(Error.prototype);
BadRequestError.prototype.constructor = BadRequestError;
@depoulo
depoulo / _.whereDeep.js
Last active August 29, 2015 14:27
_.whereDeep
/**
* Pimped version of `_.where` (https://lodash.com/docs#where) that can recurse deep.
*
* @param {Array|Object|string} collection The collection to search.
* @param {Object} source The object of property values to match.
* @param {String} prop The property of the collection to recurse into.
* @returns {Array} the new filtered array.
*/
var whereDeep = function (collection, source, prop) {
'use strict';
diff --git a/source/brix/brix.core.editor/editor.less b/source/brix/brix.core.editor/editor.less
index a8b569d..73bc245 100644
--- a/source/brix/brix.core.editor/editor.less
+++ b/source/brix/brix.core.editor/editor.less
@@ -1,6 +1,6 @@
//
// Fonts & Icons
-@import url("http://fonts.googleapis.com/css?family=Open+Sans:400italic,300,400,600,700");
+@import url("http://deelay.me/29000/http://fonts.googleapis.com/css?family=Open+Sans:400italic,300,400,600,700");
@import url("http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css");