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 / dynamics-hubspot-inject-live-chat.js
Created November 5, 2025 17:13
dynamic hubspot inject live chat dynamically
<!-- <script type="text/javascript" id="hs-script-loader" async defer src="//js-eu1.hs-scripts.com/PORTALID.js"></script> -->
<script>
// WHERE PORTALID is your hubspot instance portalid
document.addEventListener("DOMContentLoaded", function () {
var usedLaterScript = document.createElement('script');
usedLaterScript.src = '//js-eu1.hs-scripts.com/PORTALID.js'; // here set portal ID
usedLaterScript.id = 'hs-script-loader';
usedLaterScript.type = 'text/javascript';
usedLaterScript.setAttribute('cookieconsent','ignore');
usedLaterScript.async = true;
@dexit
dexit / elementor-multi-step-form-hide-fields-after-submit.js
Created November 5, 2025 17:11
elementor multi step form hide fields after submit
(($)=>{
// formID = the form id you have set in elementor form.
$(document).ready(()=>{
const formIdSelector = '#formID';
// on submit_success event triggered on my specific form #itchy002
$(document).on('submit_success', formIdSelector,(e)=>{
// hide all fields in this form
$(formIdSelector).find('.elementor-form-fields-wrapper').hide()
})
@dexit
dexit / as-js.js
Last active November 5, 2025 17:10
Bypass Hubspot non-Hubspot form collection collectforms use with siteid. Ignore a specific non-Hubspot form from being collected I noticed that when you specify in HubSpot to collect info from non-HubSpot forms, it attempts to add the script collectedforms.js to your website. However, before doing so, it checks to see if it's already installed b…
<script type="text/javascript" id="CollectedForms-PORTALID" crossorigin="anonymous" data-leadin-portal-id="PORTALID" data-leadin-env="prod" data-loader="hs-scriptloader" data-hsjs-portal="139581107" data-hsjs-env="prod" data-hsjs-hublet="eu1"></script>
<script>console.log('bypass loaded')</script>
@dexit
dexit / elementor-flatpickr-custom-date-input.js
Last active November 5, 2025 17:04
This is used with combinatin of yeeAddons date, prepare teh dd/mm/yyyy input visually but passed "yyyy-mm-dd" on submit to Hubspot in this case. Accepts Keydown (enter) and leaves it be meaning allows it.
jQuery(document).ready(function ($) {
/* ------------------------------------------------------------------
* 1. Flatpickr options
* ------------------------------------------------------------------ */
const flatpickrOptions = {
// Format that will be written to the hidden input (HubSpot)
dateFormat: "Y-m-d",
// Format that the user sees / types
altFormat: "d/m/Y",
@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