Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

:root {
/* Tailwind colors, plus some additional intermediate shades */
/* Tailwind Sky */
--blue-050: #f0f9ff;
--blue-100: #e0f2fe;
--blue-200: #bae6fd;
--blue-300: #7dd3fc;
--blue-400: #38bdf8;
--blue-500: #0ea5e9;
--blue-600: #0284c7;
@stephanieleary
stephanieleary / copy-ao3-work-urls.js
Last active February 3, 2024 18:13
Copy all AO3 work URLs on the page to the clipboard (for Calibre + FanFicFare anthologies)
/* USAGE: Copy this code into a bookmarklet creator such as https://mrcoles.com/bookmarklet/ and bookmark the result */
const links = Array.prototype.slice.call(document.querySelectorAll('ol.work.group li.work .header .heading a:first-child'));
const urls = links.map(function(elem){ return 'https://archiveofourown.org'+elem.getAttribute("href"); });
if (!urls.length) return;
urls.reverse();
const dialog = document.createElement("dialog");
@stephanieleary
stephanieleary / instafic-base.css
Last active January 15, 2024 16:22
Instafic skins for AO3: large font + limited line length for readability, based on Readability (RIP) and Instapaper. Includes white, cream, and dark modes.
/* TO USE: Add this as a site skin. This is the base for the other two color schemes.
You may use this as the preview image for the basic (white background) skin: https://www.dropbox.com/s/iutrts8fawidn0d/ao3skin-instafic-gentle-antidote.jpeg?dl=0
/**/
.listbox blockquote,
.listbox pre {
font-family: Georgia, serif;
font-size: 1.15em;
line-height: 1.4;
@stephanieleary
stephanieleary / png_quality_filter.php
Last active September 13, 2019 19:20
Filter PNG image quality in WordPress
<?php
// well-known filter to change JPG quality:
add_filter( 'jpeg_quality', function( $arg ){ return 100; } );
// lesser-known filter to change quality for any image type:
add_filter( 'wp_editor_set_quality', 'any_image_quality', 10, 2 );
add_filter( 'jpeg_quality', 'any_image_quality' );
function any_image_quality( $default_quality, $mime_type = NULL ) {
@stephanieleary
stephanieleary / print-acf-field-group.php
Created July 29, 2019 17:05
Print all ACF fields in a group with labels and values
<?php
$fields = array();
$field_group = get_page_by_title( 'GROUP TITLE HERE', OBJECT, 'acf-field-group' );
if ( is_object( $field_group ) ) {
$acf_fields = acf_get_fields_by_id( $field_group->ID );
$fields = wp_list_pluck( $acf_fields, 'label', 'name' );
}
foreach ( $fields as $field_name => $field_label ) {
@stephanieleary
stephanieleary / userstyles.css
Last active July 19, 2019 17:03
Hide new Twitter's right sidebar full of crap
.r-1ovo9ad div {
width: 0px !important;
}
.r-1ovo9ad div div.r-1oszu61 {
width: 360px !important;
}
.r-1ovo9ad form div {
width: inherit !important;
@stephanieleary
stephanieleary / tinymce-widget-styleselect.txt
Created September 5, 2017 20:21
Customizing TinyMCE's Formats (style_select) dropdown in rich text widgets in WordPress 4.8x
<?php
// PHP goes in functions.php or similar
// Callback function to filter the MCE settings
function my_mce_style_options( $init_array ) {
// Define the style_formats array
$style_formats = my_mce_styleselect_options();
// Insert the array, JSON ENCODED, into 'style_formats'
$init_array['style_formats'] = json_encode( $style_formats );
@stephanieleary
stephanieleary / bad-slugs.php
Created September 1, 2017 15:32
prevent users from saving pages with reserved rewrite rules as slugs
<?php
// prevent users from saving pages with reserved rewrite rules as slugs
// includes post types, feeds, and search
function my_reserved_slugs() {
return array(
'post',
'attachment',
'category',
@stephanieleary
stephanieleary / dashboard-my-sites.php
Created January 23, 2017 18:11
My Sites Dashboard widget to show all user's sites on network
<?php
function mysites_network_dashboard_widget_setup() {
add_meta_box(
'dashboard_mysites_widget',
'My Sites',
'dashboard_mysites_widget',
'dashboard',
'side',
'high'
@stephanieleary
stephanieleary / livewhale-calendar-widget.php
Created October 17, 2016 21:29
LiveWhale Calendar Widget
<?php
/*
Plugin Name: LiveWhale Calendar Widget (TAMU)
Description: WordPress widget to display events from a LiveWhale calendar feed.
Author: Stephanie Leary
Version: 1.0
Author URI: http://stephanieleary.com
*/
// initialize all custom widgets