Skip to content

Instantly share code, notes, and snippets.

View djcowan's full-sized avatar

djcowan djcowan

View GitHub Profile
@djcowan
djcowan / laravel_valet_setup.md
Created April 25, 2024 06:41 — forked from bradtraversy/laravel_valet_setup.md
Laravel Valet install on mac

Laravel Valet Setup (Mac)

This will get you setup with Laravel & Valet on your Mac. Quentin Watt has a good video tutorial on getting setup here as well

Install Homebrew

Go to https://brew.sh/ and copy the command and run in your terminal

It will be something like this...

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/*
* @link <https://wordpress.org/support/topic/left-and-right-image-alignment-issues-with-fse-themes/>
* @author https://wordpress.org/support/users/jharries/
* @todo widewidth...
*/
@media only screen and (min-width : 768px) {
.is-layout-constrained figure.wp-block-image.alignleft {
margin-left: calc( ( 100% - var(--wp--style--global--content-size)) / 2 );
}
@djcowan
djcowan / example-wp-list-table.php
Created March 31, 2024 05:40 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@djcowan
djcowan / function.php
Created February 23, 2024 08:08 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
<?php
# SHORTS
# DIRECTORY SEPARATOR
define( 'DS', DIRECTORY_SEPARATOR );
# PATH SEPARATOR
define( 'PS', PATH_SEPARATOR );
# Absolute path to the WordPress directory.
! defined( 'ABSPATH' )
AND define( 'ABSPATH', dirname( __FILE__ ).DS );
@djcowan
djcowan / wp-config.php
Created August 30, 2023 23:32 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@djcowan
djcowan / wp-edit-post-js-after.js
Created May 30, 2023 01:47
wp-edit-post-js-after
<script id="wp-edit-post-js-after">
( function() {
window._wpLoadBlockEditor = new Promise( function( resolve ) {
wp.domReady( function() {
resolve( wp.editPost.initializeEditor( 'editor', "page", 8, {"alignWide":false,"allowedBlockTypes":true,"allowedMimeTypes":{"jpg|jpeg|jpe":"image\/jpeg","png":"image\/png","gif":"image\/gif","webp":"image\/webp","mov|qt":"video\/quicktime","avi":"video\/avi","mpeg|mpg|mpe":"video\/mpeg","3gp|3gpp":"video\/3gpp","3g2|3gp2":"video\/3gpp2","mid|midi":"audio\/midi","pdf":"application\/pdf","doc":"application\/msword","docx":"application\/vnd.openxmlformats-officedocument.wordprocessingml.document","docm":"application\/vnd.ms-word.document.macroEnabled.12","pot|pps|ppt":"application\/vnd.ms-powerpoint","pptx":"application\/vnd.openxmlformats-officedocument.presentationml.presentation","pptm":"application\/vnd.ms-powerpoint.presentation.macroEnabled.12","odt":"application\/vnd.oasis.opendocument.text","ppsx":"application\/vnd.openxmlformats-officedocument.presentationml.s
@djcowan
djcowan / gist:b0155009a77b445d7faf0b8d159ae560
Created April 3, 2023 03:06
accordion vanilla javascript
const questions = document.querySelectorAll('#faq dt');
questions.forEach((question) => {
const button = document.createElement('button');
const h3 = document.createElement('h3');
let id = question.getAttribute('id');
if (!id) {
id = encodeURIComponent(question.textContent.trim().toLowerCase());
question.setAttribute('id', id);
/*
* @see: <https://blog.coupler.io/importhtml-function-google-sheets/>
*/
// Tables
var index = 1; [].forEach.call(document.getElementsByTagName("table"), function(elements) { console.log("Index: " + index++, elements); });
// Lists
var index = 1; [].forEach.call(document.querySelectorAll("ul,ol"), function(elements) { console.log("Index: " + index++, elements); });
@djcowan
djcowan / acc-aa.html
Created November 25, 2022 08:37
Accessiblity
​<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
<meta charset="UTF-8">
<style>
.screen-reader-only {
position: absolute;
left: -10000px;
top: auto;