Skip to content

Instantly share code, notes, and snippets.

@Quinten
Quinten / html-comment-via-layout-xml-in-magento2.xml
Created January 5, 2016 16:17
Sometimes you just need an empty container in Magento 2. But when a container is empty (contains no blocks) it is not rendered. This way you can add a html comment inside the container.
<block class="Magento\Framework\View\Element\Text" name="comment.placeholder">
<arguments>
<argument name="text" xsi:type="string"><![CDATA[<!-- -->]]></argument>
</arguments>
</block>
@Quinten
Quinten / .bash_harvest
Created December 21, 2015 22:05
small snippet from .bashrc that sets the last commit message as note in the current runing timer harvest (with sow)
function harvest {
commitmsg=$(git log -1 --pretty=%B)
sow note "$commitmsg"
}
@Quinten
Quinten / .tmux.conf
Last active December 18, 2015 10:54
tmux configuration
# vim like bindings
set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# colors
set -g default-terminal "xterm-256color"
# keys
set -g xterm-keys on
@Quinten
Quinten / countCSSRules.js
Created December 2, 2015 09:59 — forked from krisbulman/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE. — This snippet has been modified to count more than just the first level of CSSStyleRule objects within CSSMediaRule.
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@Quinten
Quinten / magento2-maintenance-mode.sh
Created October 16, 2015 08:55 — forked from Marko-M/magento2-maintenance-mode.sh
Activate maintenance mode on Magento 2 w/ IP address exclusion list
#!/bin/bash
# Comma separated list of IPs to be excluded
echo "123.123.123.123,234.234.234.234">var/.maintenance.ip
# For the rest of the world we go down for maintenance NOW
touch var/.maintenance.flag
@Quinten
Quinten / My Resize Script.jsx
Created October 1, 2015 11:51
Javascript resize script for photoshop. Put it in /Applications/Photoshop/Presets/Scripts . Then run from File → Scripts → My Resize Script
// resize min 900 x 500
// get a reference to the current (active) document and store it in a variable named "doc"
doc = app.activeDocument;
// change the color mode to RGB. Important for resizing GIFs with indexed colors, to get better results
doc.changeMode(ChangeMode.RGB);
// these are our values for the end result width and height (in pixels) of our image
var fWidth = 900;
var fHeight = 500;
@Quinten
Quinten / transform_date.php
Created June 15, 2015 09:06
transform a date
$originalDate = "2010-03-21";
$newDate = date("d-m-Y", strtotime($originalDate));
@Quinten
Quinten / gist:791e49ba46423fb6cbb5
Created June 9, 2015 14:00
smooth scroll script
var scrollVal = 0;
setInterval(function () {
scrollVal += 3;
jQuery('body').scrollTop(scrollVal);
},17);
@Quinten
Quinten / cookie.js
Last active August 29, 2015 14:18
fast js cookies
@Quinten
Quinten / play-icon.css
Last active August 29, 2015 14:04
play-icon in css
.youtube-thumb {
height: 100px;
line-height: 100px;
background: #fff;
position: relative;
}
.youtube-thumb:before {
content: " ";
display: block;