Skip to content

Instantly share code, notes, and snippets.

View dexit's full-sized avatar
🎯
Focusing

Rihards Mantejs dexit

🎯
Focusing
View GitHub Profile
@dexit
dexit / lookup-elementor.js
Last active November 4, 2025 14:23
Lookup postcodes from input field set values hidden from json response
jQuery(document).ready(function ($) {
/* ------------------------------------------------------------------ */
/* 1️⃣ Grab the postcode field and the region dropdown */
/* ------------------------------------------------------------------ */
var $zipInput = $('#form-field-zip');
var $regionSelect = $('#form-field-uk_region');
/* ------------------------------------------------------------------ */
/* 2️⃣ Find the reference point – the last hidden field in the form */
/* ------------------------------------------------------------------ */
@dexit
dexit / v2-proxy.js
Last active November 4, 2025 13:42
CORS PROXY with POSTCODE lookup
// --- CONFIGURATION VIA ENVIRONMENT VARIABLES ---
// In your Worker's Settings -> Variables, set the following:
//
// 1. ALLOWED_ORIGINS (Whitelist for target URLs for the proxy)
// Value: *.example.com, api.another.com, my-domain.net
//
// 2. PROXY_ENDPOINT (The path the proxy will run on)
// Value: /corsproxy/
//
// 3. SEARCH_PARAM (The query parameter for the proxy, e.g., 'url' or 'apiurl')
@dexit
dexit / corsproxy
Created November 4, 2025 13:02
CF Worker Cors Proxy Preflight HEaders Allowed whitelist domains with wildcard support and endpoint url control
// --- CONFIGURATION VIA ENVIRONMENT VARIABLES ---
// In your Worker's Settings -> Variables, set the following:
//
// 1. ALLOWED_ORIGINS (Whitelist for target URLs)
// Value: *.example.com, api.another.com, my-domain.net
//
// 2. PROXY_ENDPOINT (The path the proxy will run on)
// Value: /corsproxy/
// A list of headers to remove from the origin's response.
@dexit
dexit / worker.js
Created October 30, 2025 12:54 — forked from vsg24/worker.js
Running your own CORS proxy using Cloudflare Workers
async function handleRequest(request) {
const url = new URL(request.url)
let apiUrl = url.searchParams.get('apiurl')
if (apiUrl == null) {
apiUrl = API_URL
}
// Rewrite request to point to API url. This also makes the request mutable
// so we can add the correct Origin header to make the API server think
// that this request isn't cross-site.
request = new Request(apiUrl, request)
<?php
/**
* Plugin Name: WP Microsoft Teams API
* Plugin URI: https://example.com/wp-ms-teams-api
* Description: A WordPress plugin that provides an API wrapper for Microsoft Teams.
* Version: 1.0.0
* Author: Your Name
* Author URI: https://example.com
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
<?php
/**
* Plugin Name: WP Microsoft Outlook API
* Plugin URI: https://example.com/wp-ms-outlook-api
* Description: A WordPress plugin that provides an API wrapper for Microsoft Outlook.
* Version: 1.0.0
* Author: Your Name
* Author URI: https://example.com
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
<?php
/**
* Plugin Name: WP Gemini API
* Plugin URI: https://example.com/wp-gemini-api
* Description: A WordPress plugin that provides an API wrapper for Gemini.
* Version: 1.0.0
* Author: Your Name
* Author URI: https://example.com
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/plugins.php",
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
@dexit
dexit / GEMINI.md
Created October 23, 2025 13:48 — forked from philschmid/GEMINI.md
Gemini CLI Plan Mode prompt

Gemini CLI Plan Mode

You are Gemini CLI, an expert AI assistant operating in a special 'Plan Mode'. Your sole purpose is to research, analyze, and create detailed implementation plans. You must operate in a strict read-only capacity.

Gemini CLI's primary goal is to act like a senior engineer: understand the request, investigate the codebase and relevant resources, formulate a robust strategy, and then present a clear, step-by-step plan for approval. You are forbidden from making any modifications. You are also forbidden from implementing the plan.

Core Principles of Plan Mode

  • Strictly Read-Only: You can inspect files, navigate code repositories, evaluate project structure, search the web, and examine documentation.
  • Absolutely No Modifications: You are prohibited from performing any action that alters the state of the system. This includes:
@dexit
dexit / SSL-nginx-Docker.md
Created October 2, 2025 18:24 — forked from dahlsailrunner/SSL-nginx-Docker.md
SSL with Docker images using nginx as reverse proxy

Docker with SSL and an nginx reverse proxy

Running your ASP.NET Core (or other) application in Docker using SSL should not be an overwhelming task. These steps should do the trick.

Run the following steps from a Linux terminal (I used WSL or WSL2 on Windows from the Windows Terminal).

1. Create a conf file with information about the cert you'll be creating

It should look something like the content below; call it my-site.conf or something like that.