Skip to content

Instantly share code, notes, and snippets.

View invmatt's full-sized avatar

Matt Otley invmatt

View GitHub Profile
@invmatt
invmatt / default.conf
Last active April 5, 2017 13:20
Magento 2 NGINX default config
upstream fastcgi_backend {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name domain.com;
set $MAGE_ROOT /usr/share/nginx/html;
set $MAGE_MODE production;
@invmatt
invmatt / material-icons-array.php
Created February 9, 2017 14:02
Array for Google's material icons. Useful for WP custom metaboxes
<?php
/**
* Creates an array for Google's Material design icons. Can be used with
* custommetaboxes select field.
*/
$google_icons = array(
'3d_rotation' => '3d_rotation',
'access_alarm' => 'access_alarm',
@invmatt
invmatt / flex-grid.scss
Created October 6, 2016 11:22
Stupidly simple grid
.flex-grid {
display: flex;
flex-wrap: wrap;
margin: -0.5em;
& > * {
flex: 1 0 5em;
margin: 0.5em;
}
}
@invmatt
invmatt / getsetcookies.js
Created May 5, 2016 09:55
Quick way to set/get cookies in JS
/**
* Set/Get cookie functions
* setCookie('test','1');
* getCookie('test');
*/
function setCookie(key, value) {
var expires = new Date();
expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
@invmatt
invmatt / functionality.js
Last active May 7, 2019 14:03
Medium style image loading.
window.onload = function() {
var placeholder = $('.progressive-media'),
small = $('.progressive-media__small');
var img = new Image();
img.src = small.src;
img.onload = function () {
small.classList.add('loaded');
};
@invmatt
invmatt / _grid.scss
Last active September 19, 2016 15:58
CSSWizardry grid system. Switched worded grid names for numbers. This Gist can be installed via NPM using npm install gist:a8c8ebc1d6317882633e --save-dev
/**
* CSSW Grid System
* Based off https://github.com/csswizardry/csswizardry-grids
*
* Modified to change word based class system to numbered & additional tidyup
*/
$class-type: if($use-silent-classes, unquote("%"), unquote("."));
@invmatt
invmatt / ukmap.svg
Created September 15, 2015 10:08
Map of the UK with county classes. Jersey has been blown up by approx 150%.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@invmatt
invmatt / sublime_settings
Created October 15, 2014 08:45
sublime user settings
{
"always_show_minimap_viewport": true,
"auto_find_in_selection": true,
"bold_folder_labels": false,
"close_windows_when_empty": false,
"copy_with_empty_selection": false,
"create_window_at_startup": false,
"dictionary": "Packages/Language - English/en_GB.dic",
"drag_text": false,
"file_exclude_patterns":
// JQuery Plugin Starter
// ----------------------------------------------------
// Setup a namespace we can use for data, events etc.
// Wraps methods internally with support for arguments.
//
// $('div').myplugin(); //call init
// $('div').myplugin({color:'green'}).fadeIn(); //init with options and chained
// $('div').myplugin('destroy'); //custom method
// $('div').myplugin('custom',10,2); //custom method with arguments
//
$zindex: (
modal : 9000,
overlay : 8000,
dropdown : 7000,
header : 6000,
footer : 5000
);
.header {
z-index: map-get($zindex, header);