Skip to content

Instantly share code, notes, and snippets.

@Log1x
Log1x / PostSearch.php
Last active June 27, 2024 07:59
Post Search component example using Acorn v4 and Livewire 3
<?php
namespace App\Livewire;
use Livewire\Attributes\Url;
use Livewire\Component;
use WP_Query;
class PostSearch extends Component
{
@joshuafredrickson
joshuafredrickson / filters.php
Last active May 5, 2024 08:24
Preload font files found in Roots Sage 10 (bud.js) manifest.json
<?php
use Illuminate\Support\Str;
/**
* Add `rel="preload"` to font files found in the manifest
*/
add_filter('wp_head', function (): void {
echo collect(
json_decode(asset('manifest.json')->contents())
@syahzul
syahzul / how-to-install-php-oci8-for-macos-ventura-sonoma-and-above-on-apple-silicon-macs.md
Last active June 25, 2024 13:01
How to install PHP OCI8 for macOS Ventura/Sonoma on Apple Silicon Macs - outdated

How to install PHP OCI8 for macOS Ventura/Sonoma on Apple Silicon Macs - outdated

Caution

Finally Oracle release Instant Client for arm64 architecture. Refer new tutorial How to install PHP OCI8 for macOS Ventura/Sonoma on Apple Silicon Macs (arm64 version) here.

Note
If your using macOS Monterey or below, please refer to How to install OCI8 on macOS (Monterey) M1 Processor with PHP 8.1

macOS Ventura and above, duplicating and renaming Terminal.app are disabled by Apple. In order to install the OCI8, we need to switch between arm64 and x86_64 architecture.

@syahzul
syahzul / how-to-install-oci8-on-macos-monterey-m1-processor-with-php-81.md
Last active May 10, 2024 20:21
How to install OCI8 on macOS (Monterey) M1 Processor with PHP 8.1

This is an attempt to describe how to pass data to Gutenberg InnerBlocks when using ACF and ACF Composer. I can not share complete code examples ATM since due to reasons that I can not affect.

We will be using Gutenbergs Context. It is not 100% straight forward or easy to explain but in short, a block can provide context to its inner blocks and use context that is passed down to it.

Disclaimer: I am writing this while focusing on other things so please forgive (and tell) me if anything is unclear. It probably helps if you have some deeper understanding of how ACF and ACF Composer works.

In order to do this you need to use ACF 6 which is in alpha 2 at the time of writing this.

ACF composer needs to be updated with the changes in [this commit](https://github.com/Log1x/acf-composer/c

@blift
blift / OffCanvas.js
Last active February 9, 2024 08:23
Drilldown menu for Wordpress sub pages. For Sage by Roots + TailwindCSS
function OffCanvas() {
const offOPen = document.getElementById('offcanvas__open');
const offMenu = document.getElementById('offcanvas__menu');
const body = document.body;
const offNav = document.querySelectorAll('.nav-secondary ul .menu-item');
// Aria expanded
const ariaMenu = () => {
if( offMenu.classList.contains('is-active') ) {
@Log1x
Log1x / phpmailer-smtp.php
Created March 11, 2022 16:03
Simple PHPMailer SMTP mu-plugin
<?php
use function Env\env;
/**
* Plugin Name: PHPMailer SMTP
* Plugin URI: https://roots.io/bedrock/
* Description: Simple PHPMailer SMTP configuration for Bedrock.
* Version: 1.0.0
* Author: Roots
@joshuafredrickson
joshuafredrickson / block-editor-cleanup.php
Last active April 19, 2022 13:47
Block Editor Cleanup for WordPress 5.9 and Classic Editor (mu-plugin)
<?php
/**
* Plugin Name: Block Editor Cleanup
* Plugin URI: https://github.com/WordPress/gutenberg/issues/38299#issuecomment-1025520487
* Version: 1.0.1
* Description: Remove WP 5.9 default block editor styles when using Classic Editor
* Author: joshuafredrickson
* Author URI: https://joshuafredrickson.com
* License: GNU General Public License v2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@huytd
huytd / wordle.md
Last active May 16, 2024 20:39
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@sindresorhus
sindresorhus / esm-package.md
Last active July 3, 2024 15:07
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.