Skip to content

Instantly share code, notes, and snippets.

View fribibb's full-sized avatar

Tim Hurley fribibb

View GitHub Profile
@fribibb
fribibb / wp-rename-uploads.php
Last active June 28, 2022 08:11 — forked from onnimonni/rename-uploads.php
Remove accents from Wordpress uploads. This renames all files and replaces corresponding attachment in WordPress database. This helps to avoid possible problems with *EXITSTING* filenames. To avoid this in future install mu-plugin which hooks in 'sanitize_file_name'
<?php
/**
* Replace-uploads.php
* This replaces all accents from your uploads
* you can run this with wp-cli: $ php wp-cli.phar eval-file rename-uploads.php
*
* You may need to run the outputted move commands in order to update the filenames.
*/
if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {
-- Function ("prepared statement") for MySQL, equivalent to PHPs ucwords --
-- base off: https://brianloomis.wordpress.com/2009/10/15/working-with-titlecase-in-mysql/
DROP FUNCTION IF EXISTS proper;
SET GLOBAL log_bin_trust_function_creators=TRUE;
DELIMITER |
CREATE FUNCTION proper( str VARCHAR(128) )
RETURNS VARCHAR(128)
BEGIN
DECLARE c CHAR(1);
@fribibb
fribibb / svg-graph.html
Created April 20, 2020 07:41
A Simple SVG graph
<head>
<style>
html,
body {
height: 100%;
}
body {
background: #333;
padding: 20px;
/*
* From:
* https://medium.com/pixel-and-ink/avoiding-jagged-edges-on-gradients-f485cc7401f5
*/
background: linear-gradient(176deg, white, white 75%, black calc(75% + 1px), black 100%);
// Based off:
// https://css-tricks.com/snippets/css/shake-css-keyframe-animation/
.shake:hover {
animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
perspective: 1000px;
}
.bg-clip {
// Make it pretty ///////////////////
font-size: 30rem;
font-weight: 900;
text-transform: uppercase;
text-align: center;
// The clipping /////////////////////
// Fallback colour
color: #000;
@fribibb
fribibb / _browser-hacks.scss
Last active July 10, 2018 06:25
A11y/W3C ☑️ Star ratings (X-browser support = WIP)
// Browser hacks.
// ...So MS browser specific styles basically.
// IE10 + 11
// @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
// IE 10 + 11
html[data-useragent*='MSIE 10'],
html[data-useragent*='Trident'][data-useragent*='rv:11.0'] {
.star-rating-static {
width: auto !important;
// From: https://codepen.io/GeorgePark/pen/EEGJEj
.gradient-border {
flex-shrink: 0;
margin: 20px;
height: calc(150px + 6vw);
width: calc(150px + 6vw);
border: calc(8px + 0.2vw) solid transparent;
background-origin: border-box;
background-clip: content-box, border-box;
<!-- From https://codepen.io/thomashigginbotham/pen/aYqvqQ -->
<style>
@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700");
body {
font-family: 'Open Sans', sans-serif;
}
details {
margin: 1rem;
}
/* https://codepen.io/irksum/pen/qxbarb */
@supports ( (--plx: 0) and (position: sticky) ) {
:root {
--plx-perspective: 1;
}
.parallax {
position: sticky;
width: 100vw;
height: 100vh;