Skip to content

Instantly share code, notes, and snippets.

@danmaby
danmaby / blueprint.json
Last active October 30, 2024 15:54
Test WordPress Playground Blueprint
{
"login": true,
"landingPage": "/wp-admin/",
"preferredVersions": {
"php": "8.3",
"wp": "beta"
},
"features": {
"networking": true
},
@danmaby
danmaby / description.md
Created October 17, 2024 07:40
Next.js 14 + tRPC + Appwrite: Session cookie not being set or persisted

I'm building a Next.js 14 application with tRPC and Appwrite for authentication. The T3 Stack was used as a starting point for this app. I'm encountering an issue where the session cookie is not being set or persisted after a successful login.

Environment:

  • Next.js 14 (App Router)
  • tRPC
  • Appwrite for authentication
  • Running on localhost with custom subdomain (my.example.localhost:3000)

Steps to reproduce:

@danmaby
danmaby / functions.php
Created September 28, 2023 10:38
Simple log in / log out shortcode for WordPress. Conditionally display a login or logout text link based on users logged in status.
<?php
/**
* Shortcode to display "Log in" or "Log out" link.
*
* @return string HTML string for the login/logout link.
*/
function dm_login_logout_shortcode() {
// Initialize an empty string to hold the output HTML.
$output = '';
@danmaby
danmaby / export_woo_subscriptions_to_csv.php
Last active September 13, 2023 09:37
Export WooCommerce Subscriptions to CSV. Provides a `Export Subscriptions` button in Woo admin menu
<?php
/**
* Plugin Name: Export WooCommerce subscriptions
* Plugin URI: https://www.blue37.com/
* Description: Export WooCommerce subscriptions to a CSV file.
* Version: 0.0.1
* Requires at least: 6.0
* Requires PHP: 8.0
* Author: Blue 37
@danmaby
danmaby / functions.php
Created July 24, 2023 08:52
A shortcode that displays the SEO description generated by the Filter Everything Pro plugin
/**
* Adds a shortcode that displays the SEO description generated by the Filter Everything Pro
* plugin. If no description is available, the shortcode will display the default content. An
* an optional 'default' attribute can be used to specify the default content.
*
* @param array $atts An array of shortcode attributes.
* @return string The shortcode output.
*/
function ps_add_filters_seo_description_shortcode($atts)
{
@danmaby
danmaby / functions.php
Created November 7, 2022 08:10
Set default button styles for GenerateBlocks
<?php
/*
* set GenerateBlocks button defaults
*
* @url https://github.com/tomusborne/generateblocks/blob/c2aad72f6868001c6f7fa9b606cafef511eebd1b/includes/defaults.php#L231-L243
*/
add_filter("generateblocks_defaults", function ($defaults) {
$color_settings = wp_parse_args(
get_option("generate_settings", []),
generate_get_color_defaults()
@danmaby
danmaby / readme.md
Created April 1, 2022 12:02
Install SSL with Node.js, Express and Socket.io

Getting started

A basic installation of Node.js, Express, and Socket.io served over https:// using a Letsencrypt SSL certificate.

Step 1 - Build DO Droplet (or server of your choice)

  • Spin up DO droplet
  • Set up DNS
  • Access the server via SSH
@danmaby
danmaby / attendee-login-open.php
Last active March 23, 2022 09:39
Apply Conditional Blocks PHP Logic using WordPress Pods custom settings options
<?php
/**
* Function to determine if login blocks should show.
*
* @return boolean true/false to show the block or not.
*/
function dv_atttendee_login_open( $option_name, $defaults = array() ) {
$options = get_option('dv_event_settings_dv_settings_allow_attendee_login');
//checking if setting is empty
@danmaby
danmaby / jitsi-meet-multi-server.md
Last active April 3, 2022 16:50
This tutorial is for jitsi-meet installation using 2 server or more. The main server will contain jitsi-meet react source code, prosody, nginx, and jicofo. The videobridge will be installed seperatelly on the second server and so on.

How to Install Jitsi Meet with Multi Server Configuration

This tutorial is for jitsi-meet installation using 2 server or more. The main server will contain jitsi-meet react source code, prosody, nginx, and jicofo. The videobridge will be installed seperatelly on the second server and so on.

Prerequisite

  1. Minimum 2 servers with 1 IP Public each
  2. Ubuntu 18.04

Sudo Privileges

Before starting make sure there are no permission issues on the installation.

@danmaby
danmaby / restart-jitsi.bash
Created June 19, 2020 08:54
Restart Jitsi Meet
sudo systemctl restart prosody
sudo systemctl restart jicofo
sudo systemctl restart jitsi-videobridge2
sudo systemctl restart nginx