Skip to content

Instantly share code, notes, and snippets.

View ajitbohra's full-sized avatar
🎯
Scaling Operations @lubusIN

Ajit Bohra ajitbohra

🎯
Scaling Operations @lubusIN
View GitHub Profile
@justintadlock
justintadlock / accordion-faqs-schema.php
Last active November 13, 2025 19:56
WordPress Accordion Block w/FAQ Schema
<?php
// You need to add an `is-faqs` class to the wrapping Accordion block to trigger the
// below markup changes.
add_filter('render_block_core/accordion', function ($content) {
$processor = new \WP_HTML_Tag_Processor($content);
if (! $processor->next_tag([ 'class_name' => 'is-faqs' ])) {
return $processor->get_updated_html();
@sethrubenstein
sethrubenstein / AGENTS.md
Last active October 11, 2025 14:07
GitHub Copilot WordPress

AGENTS.md

This file provides guidance to AI agents when working with code in this repository.

PRC Platform Architecture

This is a WordPress VIP platform for Pew Research Center's digital publishing. It's built as a monorepo with:

  • WordPress multisite structure with subdirectory setup
  • Monorepo architecture using npm workspaces
@youknowriad
youknowriad / log.js
Created April 24, 2024 22:47
Gutenberg Log Deprecations
const { createElement: el, useState, useEffect } = React;
const PanelBody = wp.components.PanelBody;
const PluginSidebar = wp.editor.PluginSidebar;
const addAction = wp.hooks.addAction;
const registerPlugin = wp.plugins.registerPlugin;
function MyPluginSidebar() {
const [ deprecations, setDeprecations ] = useState( [] );
useEffect( () => {
addAction(
@davidallenlewis
davidallenlewis / social-link-custom-icons.js
Last active February 13, 2025 20:31
Add custom icons to Social Link Block (Editor)
@davidallenlewis
davidallenlewis / social-link-custom-icons.php
Last active February 13, 2025 20:35
Add custom icons to Social Link Block (Front End)
@tresorama
tresorama / dynamic-data.text.tsx
Created August 25, 2023 08:10
wordpress-gutenberg--POC--dynamic-data
import { createHigherOrderComponent } from '@wordpress/compose';
import * as wpHooks from '@wordpress/hooks';
import { BlockControls, InspectorControls } from '@wordpress/block-editor';
import { PanelBody, PanelRow } from '@wordpress/components';
import { Icon, backup as backupIcon } from '@wordpress/icons';
import { Post, useEntityRecord } from '@wordpress/core-data';
import { store as coreStore } from '@wordpress/core-data';
import { useSelect, useDispatch } from '@wordpress/data';
import { BlockEditProps } from '@wordpress/blocks';
const plugin = require('tailwindcss/plugin')
module.exports = {
mode: 'jit',
purge: ['./resources/**/*.{js,vue,blade.php}'],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
@amalmurali47
amalmurali47 / edit_commit_history.md
Last active October 28, 2025 19:07
Change ownership of selected older commits in Git
  1. Clone the repo.
  2. Use git rebase -i --root
  3. vim will open. Select the commits you want to modify by changing pick to edit. If you would like to change all the commits, perform the following replace: :%s/^pick/edit/g. This command changes all instances of "pick" at the start of lines to "edit".
  4. You will now be shown all the selected commits one by one. Each commit message will be displayed. You have two options:
    • If you would like to keep the commit author details the same, do a git rebase --continue.
    • If you would like to change it to a different name/email, do git commit --amend --reset-author. If --reset-author is specified, it will use the details from your git config. (If you need to specify an alternate name/email, you can do so with --author="John Doe <[email protected]>". If you would like to change the time to a previous date, you can do so with --date "2 days ago".)
  5. Do the same for all the commits and finish the rebase.
  6. Perform git push -f origin master to
@samselikoff
samselikoff / tailwind.config.js
Created April 16, 2021 15:57
Firefox plugin for Tailwind CSS. Add styles that target Firefox browser only.
const plugin = require("tailwindcss/plugin");
module.exports = {
mode: "jit",
purge: {
content: ["./src/**/*.{js,ts,jsx,tsx,mdx,vue}"],
},
theme: { extend: {} },
variants: {},
plugins: [
@sindresorhus
sindresorhus / esm-package.md
Last active November 25, 2025 17:53
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.