Skip to content

Instantly share code, notes, and snippets.

View micjamking's full-sized avatar
🏝️
Working remote

Mike King micjamking

🏝️
Working remote
View GitHub Profile
@micjamking
micjamking / _triangle-mixin.scss
Created March 22, 2017 02:47
Sass Triangle Shape Mixin
/**
* Triangle CSS Shape
* https://css-tricks.com/examples/ShapesOfCSS/
* @usage @include triangle('down', 10px, #111)
*/
@mixin triangle ($direction: 'up', $size: 100px, $color: red){
width: 0;
height: 0;
@if $direction == 'up' {
@micjamking
micjamking / ie-conditional.html
Created June 1, 2017 20:23
How To Create an IE-Only Styles
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
// ...
</html>
@micjamking
micjamking / popular-posts-functions.php
Last active April 14, 2019 09:13
[WordPress] Display Popular Posts by Page Views
@micjamking
micjamking / labels.json
Created July 11, 2017 22:10
GitHub Labels
[
{ "name": "Status: Abandoned", "color": "#000000" },
{ "name": "Status: Accepted", "color": "#009800" },
{ "name": "Status: Available", "color": "#bfe5bf" },
{ "name": "Status: Blocked", "color": "#e11d21" },
{ "name": "Status: Completed", "color": "#006b75" },
{ "name": "Status: In Progress", "color": "#cccccc" },
{ "name": "Status: On Hold", "color": "#e11d21" },
{ "name": "Status: Pending", "color": "#fef2c0" },
{ "name": "Status: Review Needed", "color": "#fbca04" },
@micjamking
micjamking / delayPromise.js
Last active July 14, 2020 03:16
Chaining delays in JavaScript (setTimeout) using Promises (ie. delay(func1, 1000).delay(func2, 1000).delay(func3, 1000))
/**
* Daisy chaining delays (setTimeout) using Promises
*
* Ex: delay(func1, 1000).delay(func2, 1000).delay(func3, 1000);
*
* @param {Function} cb - Callback function
* @param {Number} ms - Time delay (in milliseconds)
* @return chainable delay Promise (ie. delay(cb, ms).delay(cb, ms).delay(cb, ms)...)
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#Creating_a_Promise_around_an_old_callback_API
@micjamking
micjamking / custom_search.php
Last active August 18, 2017 01:07
Custom Search using GET params In WordPress
<?php
/**
* @fileoverview custom filter and search
*
* References
* @see http://michaelsoriano.com/how-to-create-an-advanced-search-form-for-wordpress/
* @see http://wordpress.stackexchange.com/a/50051/36130
* @see https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
*/
@micjamking
micjamking / xhrPromise.js
Created August 25, 2017 10:45
Vanilla JavaScript XMLHttpRequest as Promise
/**
* Native XMLHttpRequest as Promise
* @see https://stackoverflow.com/a/30008115/933951
* @param {Object} options - Options object
* @param {String} options.method - Type of XHR
* @param {String} options.url - URL for XHR
* @param {String|Object} options.params - Query parameters for XHR
* @param {Object} options.headers - Query parameters for XHR
* @return {Promise} Promise object of XHR
*/
@micjamking
micjamking / wp-post_status-change.SQL
Created October 24, 2017 18:42
Bulk update ALL WordPress post statuses in SQL
# Change post_type value if targeting 'page' or a custom post type
# Change ALL posts status from 'publish' to 'draft'
UPDATE wp_posts SET post_status = 'publish' WHERE (post_type = 'post' and post_status = 'draft')