Skip to content

Instantly share code, notes, and snippets.

Playground Comment Worker

This simple playground.yml creates a comment that opens a WordPress Playground and installs the plugin from the current repository. The current iteration only works with plugins that do not require a build step.

Playground test comment in action

CORS issues

Because GitHub doesn't send the right CORS headers for zip files to be able to install them in a Playground, you need a reverse proxy to bypass the CORS restrictions. The Worker below in worker.js can be used as a Cloudflare worker that

@charlesteh
charlesteh / cf-workers-ai-bge-small.js
Last active March 21, 2024 07:06
Cloudflare Workers AI baai/bge-small deployment script
// Made by @charlestehio: https://x.com/charlestehio
// Usage: https://abc.workers.dev/?query=your%20embedding%20query
import { Ai } from './vendor/@cloudflare/ai.js';
export default {
async fetch(request, env) {
// Parse the URL to get query parameters
const url = new URL(request.url);
var query = url.searchParams.get('query');
@bluelovers
bluelovers / ChatGPT Stable Diffusion prompts generator.txt
Last active April 16, 2024 03:22
using ChatGPT as Stable Diffusion prompts generator
Stable Diffusion is an AI art generation model similar to DALLE-2.
Here are some prompts for generating art with Stable Diffusion.
Example:
- A ghostly apparition drifting through a haunted mansion's grand ballroom, illuminated by flickering candlelight. Eerie, ethereal, moody lighting.
- portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, smooth
- pirate, deep focus, fantasy, matte, sharp focus
- red dead redemption 2, cinematic view, epic sky, detailed, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful
- a fantasy style portrait painting of rachel lane / alison brie hybrid in the style of francois boucher oil painting, rpg portrait
@pingram3541
pingram3541 / functions.php
Last active September 14, 2023 12:23
How to hide Elementor Section or Widget for use with custom conditional
//How to hide any widget with an id of 'test':
add_filter( 'elementor/frontend/widget/should_render', function( $bool, $element ){
$settings = $element->get_settings();
if( 'test' === $settings['_element_id'] && 'heading' === $type ){
return false;
} else { return true }
}, 10, 3);
//How to hide any specific type of widget':
add_filter( 'elementor/frontend/widget/should_render', function( $bool, $element ){
@edheltzel
edheltzel / php-server-with-wordpress.md
Last active November 26, 2020 21:33
Using PHP's built in server for WordPress development.

Preface

So in the past, I've used MAMP/MAMP Pro apps and others alike. I've also, setup my own local MAMP stack with homebrew, that used dnsmasq to dynamically add vhosts anytime I added a new folder to the Sites folder which made it very convenient. But, then I started running into other environment issues with PHP versions on remote machines/servers not being updated or some other crazy thingamabob breaking. I researched and invested time in Vagrant, but that seem to break more often than my homebrew setup. So I researched again investing time into Docker via Docker for Mac (which is BAMF), which I'm sold on and use daily, but it still seems a little bleeding edge and not so simple to wrap your head around the concept. Not to mention I don't have a real use case to play with and take advantage of all the features that come packed with Docker.

This is the beginning of trying to find something more simple, and slightly quicker to setup.

var AWS = require('aws-sdk');
var https = require('https');
exports.handler = function(event, context) {
var sesNotification = event.Records[0].ses;
var messageId = sesNotification.mail.messageId;
var receipt = sesNotification.receipt;
var from = sesNotification.mail.commonHeaders.from[0];
var appUrl = 'https://www.example.com'
@eduardozulian
eduardozulian / wp-taxonomy-dropdown.php
Last active May 5, 2024 14:45
Callback function for 'meta_box_cb' argument inside register_taxonomy() that replaces the regular checkboxes with a plain dropdown list
<?php
/**
* Callback function for taxonomy meta boxes
*
* A simple callback function for 'meta_box_cb' argument
* inside register_taxonomy() that replaces the regular
* checkboxes with a plain dropdown list
*
* @param [type] $post [description]
* @param [type] $box [description]
@mathetos
mathetos / functions.php
Created January 23, 2015 06:18
User-Friendly Styled Content in the WordPress Editor
<?php
/*
* Add "Formats" dropdown to TinyMCE Editor
*/
function matt2015_mce_formats($buttons) {
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('mce_buttons_2', 'matt2015_mce_formats');
@pe3
pe3 / scrape_entire_website_with_wget.sh
Last active March 9, 2024 17:42
Scrape An Entire Website with wget
this worked very nice for a single page site
```
wget \
--recursive \
--page-requisites \
--convert-links \
[website]
```
wget options
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.