Skip to content

Instantly share code, notes, and snippets.

@devwax
devwax / hugo-clone-local-theme.txt
Last active May 27, 2018 03:52
Clone a local Hugo theme for customization
> cd themes/
> git clone ./theme-name ./theme-name-custom
@devwax
devwax / WordPress - Dynamic Copyright Years.php
Last active February 27, 2020 04:44
Automatically display copyright year range, if applicable, in WordPress theme
@devwax
devwax / embedded-webp.html
Last active March 1, 2020 03:20
Embedded Base64 WebP image w/ JPEG fallback
<picture>
<source srcset="data:image/webp;base64,UklGRrYPAABXRUJQVlA4IKoPAABwVgCdASpmA1oAPm02l0kkIqIhIRGqgIANiWlu4XCBG/Nd86f4ftj/xn5O+gflE9rSrLlv5P9+P03ri7Gfj5qC+0d2fAF+i/3TvxNVnxP/0PcD4KDzv2Cv6B5uujjUZF8GzMzMzMzMy/qdi6DbZEREREREREREREREREREREREREQ5443ELiTqCPvGvwA8cljijeyzQajOxqaW7gQqcEUBM7v3ul9/U8jm5aTeDeoz5e0qAq1QVtH+gYND2A+0UZ9iqsnZEREREREREQ6Vced/xZku2l0391SgwayhP6JgZgrRukpYXHkrOL+CknVzPnjyMtcNjL5qmZjg3YdWqqHlW13nLuvllV6RuJWqS9IIOqW2FFBhlB4H7WI2hGANPVM8x1nHOCGzAJJBYSXBlwbpAmv4nSSggazZnJ+eJcNcHjxbqDU24lXAy+3vfV5/PZdTiM2FOl/oc5rNaABtj+lSfEsP3JkqauuL2qmeGclgYAGW2uX2PSTYPxmgTAf/ds6XeOJ36FKNr9M1qKW8JOHzFeFiupYvDTlJqSWL01NeZOcgocGhlwkjMp9izSc9P9vPh/rrc42SSSR5mEHk6GFhFUR6sp9LZxShqBGbPkXx2nSM9zAhIdjV8IN7kPJgBUp3AgYLurs8PE/mhwKi06TbR+AlUlgi+Pe7Ix6v17ae2RPI8LrOAEcbGW8NkxV39zfqON2QrQNvcVcVFmJTDDykaCiPAwURkRThy1XBnnQbxEy/cpaAO/hYzJ3Tpy5WcQJ0nGOTh3xETiKdYgqOevt2M9PyRt5cqqqi6siSz7qkCCucVGnpsvs8EplpnYqd9aP+B5lviObD+M7n992dpBfVYwYP0ZjNKaY+GNJv+j5v67a0BK3ZEREREREREREREREREREREREREREREREREREREREREREREREREOQAAP7/OcCidMREp
@devwax
devwax / php.ini
Last active March 8, 2020 04:38
PHP Debugger + VSCODE + Local by Flywheel
[Xdebug]
zend_extension = /opt/php/7.2.0/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port="9000"
xdebug.profiler_enable=0
xdebug.overload_var_dump=off
xdebug.remote_host="172.17.0.1"
xdebug.profiler_enable_trigger = 1
# Pull remote branch to server
# https://stackoverflow.com/a/9537923/2480125
git fetch origin
git checkout --track origin/feb-2020
# Untrack directory that was previously commited but should now be ignored
# https://stackoverflow.com/a/7927283/2480125
git rm -r --cached wp-content/plugins
git commit "'Remove ignored directory /****/"
@devwax
devwax / functions.php
Created April 29, 2020 06:40
WP - Admin Recent History
add_action( 'admin_init', 'admin_recent' );
// add_action( 'current_screen', 'admin_recent' );
function admin_recent() {
// $currentScreen = get_current_screen();
// if( $currentScreen->id === "widgets" ) {
// Run some code, only on the admin widgets page
// }
// error_log(print_r($currentScreen, true));
// error_log(get_admin_url());
@devwax
devwax / wp-admin-truncate-taxonomy-descriptions.php
Last active July 8, 2020 00:43
Truncate taxonomy description in WP Admin
// Truncate taxonomy description in WP Admin
function wpse_term_description_attributes() { ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$( '.description.column-description' ).attr( 'style', 'white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:1px;' );
});
</script><?php
}
add_action( 'admin_head', 'wpse_term_description_attributes' );
@devwax
devwax / responsive-bg-image-opacity.htmll
Created July 16, 2020 18:54
Change the opacity of a background image
<style>
.container {
min-height: 400px;
}
.bg-image-opacity-7 {
background-image: linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7)), url('/assets/images/bg-image.jpg');
background-repeat: no-repeat;
background-size: cover;
background-position: center;
@devwax
devwax / fluent-forms-select-dropown-fix.css
Created July 18, 2020 06:19
Fixes Fluid Forms select dropdown chevron icon with zero right spacing
/* Fluent Forms Select Dropdown Chevron Fix */
form select.ff-el-form-control {
appearance: none;
-webkit-appearance: none;
-mod-appearance: none;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAsElEQVQ4T+3TsQ2DQAyF4Z86UzBARqBLQ0Edpc8CTMIC9Ig6RZp0GSEDZIrUiSxx6OTIvpO4EjoO+9P5yVQUfqrCHju4PVGd4QHogBn4JnjpPQM34BNqNVgDL2AEegeVvgG4AkfgbYFy3gB3B42xFnjGk1hrY6EuJrC3hxqV+jDm3828keMJYlTOJTMTS90wwII+lpeTzkxvQu6vd1kap9Sm5oIpZ/2+g9lRmYXFM/wBdYQdFSn+8wIAAAAASUVORK5CYII=) !important;
background-repeat: no-repeat;
background-position: calc(100% - 10px) center;
background-size: 17px;
}
@devwax
devwax / CSS-calc-snippets.css
Last active August 29, 2020 20:48
CSS Calc() Snippets
/* https://css-tricks.com/simplified-fluid-typography/ */
.responsive-font {
font-size: calc(2.26278rem + 2.24562*(100vw - 36rem)/39);
}
html {
font-size: 16px;
}
@media screen and (min-width: 320px) {