Skip to content

Instantly share code, notes, and snippets.

View Quinten's full-sized avatar
🔭
restless

Quinten Clause Quinten

🔭
restless
View GitHub Profile
@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 / 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 / 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 / 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 / .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 / .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 / 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 / fun-with-visual-selections-in-vim.md
Last active January 6, 2016 12:50
fun with visual selections in vim (on mac)

fun with visual selections in vim (on mac)

Math

In insert mode type some math like 2+2

Then switch to visual mode and select it.

With visual mode still active type !bc

@Quinten
Quinten / stickyfooter-flexbox.css
Created January 28, 2016 09:29
Sticky footer with flexbox
html, body {
margin: 0;
padding: 0;
height: 100%;
}
.wrapper {
display: flex;
flex-direction: column;
min-height: 100%;
@Quinten
Quinten / centered-product-image.scss
Created February 8, 2016 13:20
Centered in a square regardless of width
.product-image {
height: 0;
display: block;
position: relative;
z-index: 1;
overflow: hidden;
padding-bottom: 100%;
img {
display: block;