Skip to content

Instantly share code, notes, and snippets.

@jomurgel
jomurgel / index.js
Last active February 7, 2020 15:04
Lock/Unlock Saving for Gutenberg
/* global wp */
const {
data: {
dispatch,
},
plugins: {
registerPlugin,
},
} = wp;
@jomurgel
jomurgel / icon.php
Created April 19, 2019 18:13
SVG IE TabIndex Fixes
// Add aria-hidden="true" and focusable="false" (due to an IE bug) instead of (or in addition to) setting a negative tabindex.
<svg tabindex="-1" viewBox="0 0 512 512" aria-hidden="true" focusable="false">
<path d="">
</svg>
@jomurgel
jomurgel / theme-hooks.php
Created February 14, 2019 21:29
Add social icon to Acorn Theme social icon array
<?php
/**
* Add custom icon to social media support.
*
* @param array $social_icons array of social icons.
* @return array new social icons array.
*/
function add_social_icon( $social_icons ) {
$custom_icons = array(
@jomurgel
jomurgel / hooks.php
Last active February 6, 2019 00:14
Setup and Delete Transient for Query
<?php
/**
* Delete Career transient on post save.
*
* @since 1.0.0
* @author jomurgel
*/
function _delete_default_blog_post_transient() {
delete_transient( 'default_blog_posts' );
}
@jomurgel
jomurgel / sanitize.scss
Last active December 12, 2018 16:06
Better Formatted Sanitize SCSS
//--------------------------------------------------------------
//! sanitize.css v8.0.0
// CC0 License
// github.com/csstools/sanitize.css
//--------------------------------------------------------------
// sass-lint:disable property-sort-order, indentation, property-units, no-duplicate-properties
//-----------------------------------------
// Colors
@jomurgel
jomurgel / cpt.php
Last active September 9, 2018 06:10
Register multiple CPTs or Taxonomies in WordPress
<?php
/**
* Custom post types and/or taxonomies.
*
* @package Acorn Theme
*/
/**
* Register Custom Post Types
*/
@jomurgel
jomurgel / mediaquery.scss
Last active December 12, 2018 18:11
SCSS Breakpoint Mixin
//-----------------------------------------
// Breakpoints
//-----------------------------------------
$desktop: 1440px;
$tablet: 960px;
$mobile: 600px;
//-----------------------------------------
// Media Query Mixin
//-----------------------------------------
@jomurgel
jomurgel / .htaccess
Last active May 14, 2018 01:09
Installing Let's Encrypt with Cerbot on DigitalOcean & ServerPilot
## Redirect all HTTP and www to HTTPS
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
@jomurgel
jomurgel / arrayCheck.js
Last active July 8, 2018 21:34
Remove Differences from 2 Arrays
const array1 = [1, 2, 3, 4, 5];
const array2 = [1];
// Return all but similariy.
array1.filter( item => array2.every( item2 => item2.id !== item.id ) ); // Returns [2, 3, 4, 5]
// Return similarity.
array1.filter( item => array2.every( item2 => item2.id === item.id ) ); // Returns [1]
@jomurgel
jomurgel / arrayCheck.js
Created March 25, 2018 18:24
Remove Differences from 2 Arrays
// Remove all but similariy.
array1.filter( item => array2.every( item2 => item2.id !== item.id ) );
// REmove similarity.
array1.filter( item => array2.every( item2 => item2.id === item.id ) );