Skip to content

Instantly share code, notes, and snippets.

@aaronsummers
aaronsummers / howto.md
Created July 12, 2023 11:49
Add stubs to VS Code and DEVSENSE PHP extension

Install the stubs for ACF pro and WordPress using composer

ACF PRO stubs also installed other dependencies like WP stubs.

composer require php-stubs/acf-pro-stubs

If you're not installing the ACF stubs, add the WP stubs using the below command:

@aaronsummers
aaronsummers / nth-child.scss
Last active March 2, 2023 11:58
Conditional CSS widths using nth-child
// https://grack.com/blog/2015/01/09/abusing-css3-selectors/
// https://grack.com/assets/2015/01/nth-child/image-count.html
/* One */
img:only-child {
max-width: 100%;
}
/* Two */
@aaronsummers
aaronsummers / terminal.sh
Created December 7, 2022 10:26
Mac - Copy file contents to clipboard
pbcopy < ~/.ssh/id_rsa.pub
@aaronsummers
aaronsummers / custom-post-type.php
Created December 5, 2022 08:23
Using custom taxonomy as custom post type URL base
<?php
add_action( 'init', 'my_custom_post_types_init', 0 );
function my_custom_post_types_init()
{
/**
* Register the post types
*/
$my_post_types = array(
'property' => array(
'post_type_name_singular' => 'Property',
@aaronsummers
aaronsummers / GIT housekeeping .md
Last active November 20, 2023 08:28
GIT housekeeping

Delete and update the ignored files in your local repository.

git rm -r --cached . && git add . && git commit -am "Remove ignored files"

Remove branches not on the remote.

  1. Switch to the master branch
  2. Run this command:
@aaronsummers
aaronsummers / TinyMCE.md
Created November 1, 2022 10:54
Editing Tiny MCE settings in WordPress

The documentation list all defaults and possibilities.

  • inline – Name of the inline element to produce, for example “span”. The current text selection will be wrapped in this inline element.
  • block – Name of the block element to produce, for example "h1". Existing block elements within the selection gets replaced with the new block element.
  • selector – CSS 3 selector pattern to find elements within the selection by. This can be used to apply classes to specific elements or complex things like odd rows in a table.
  • classes – Space separated list of classes to apply to the selected elements or the new inline/block element.
  • styles – Name/value object with CSS Style items to apply such as color etc.
  • attributes – Name/value object with attributes to apply to the selected elements or the new inline/block element.
  • exact – Disables the merge similar styles feature when used. This is needed for some CSS inheritance issues such as text-de
@aaronsummers
aaronsummers / remove-tag.md
Last active September 14, 2022 09:27
Remove tags from GIT Repository

Stackoverflow // Remove from the remote

git push --delete origin YOUR_TAG_NAME

Stackoverflow // Remove from local

git tag -d YOUR_TAG_NAME

@aaronsummers
aaronsummers / cleaning git branches.md
Created July 29, 2022 14:47
Cleaning up Git Branches

Source

After working with branch per feature for a while any Git-repository becomes a mess of outdated and not finished branches.

To deal with this issue, we need to clean-up three kinds of branches:

  • Local branches – our day-to-day working branches
  • References to remote branches – aka origin/branch-name items
  • Actual remote branches – branches on remote server(e.g.: github, bitbucket, gitorius)
@aaronsummers
aaronsummers / array_flatten.php
Created June 10, 2022 12:21
Flatten Multidimentional Arrays in PHP
<?php
function array_flatten($arrays) {
if ( !is_array($arrays) )
{
return false;
}
$result = array();
foreach ( $arrays as $key => $value )
{
@aaronsummers
aaronsummers / accessibility-cache-mac.md
Created May 27, 2022 07:20
Accessibility Cache Mac
  • Open the Terminal app, found in Applications > Utilities.
  • Copy the following and press Return: sudo tccutil reset Accessibility
  • When prompted, enter your administrator password to approve the command.
  • You shouldn’t see any feedback; the command will just complete. Now immediately restart your Mac manually—don’t force restart it—from  > Restart.
  • When the macOS session is running and accepts your input, return to the Privacy tab and check any boxes needed to enable software that requires it. Some apps will prompt you after restart as they recognize they’re missing permissions.