Skip to content

Instantly share code, notes, and snippets.

@Explosion-Scratch
Explosion-Scratch / Bookmarklets.md
Last active February 27, 2025 18:07
Bookmarklets

Copy ChatGPT Transcript as markdown

javascript:void (async () => { let { default: TD } = await import("https://cdn.skypack.dev/turndown");  let json = [   ...document.querySelectorAll(".text-base"), ].map((i) => ({   html: i.innerHTML,   text: i.innerText,   markdown: new TD().turndown(i),   isPrompt: !i.querySelector(".prose"), }));  window.open(   URL.createObjectURL(     new Blob(       [         json           .map((i) =>             i.isPrompt ? `**Prompt**: ${i.text}` : `**ChatGPT**: ${i.markdown}`           )           .join("\n\n"),       ],       { type: "text/plain" }     )   ) ); })()

Google answer

Get a quick answer from google for any question

(async function answer(q) {
  var html = await fetch(
    `https://cors.explosionscratc.repl.co/google.com/search?q=${encodeURI(q)}`,
@jessedmatlock
jessedmatlock / wp_special_enqueue_script.php
Created May 1, 2022 00:57
Creates custom script and style loading for Wordpress to all adding Defer, Async, and Lazy Load attributes
<?php
/**
* Reusable loaders
*/
$specialLoadHnds = (object) array(
'scripts' => (object) array(
'async' => array(),
'defer' => array()
),
'styles' => (object) array(
add_action('fluentform_before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 123) { // 123 is your form id. Change the 123 with your own login for ID
return;
}
$redirectUrl = home_url(); // You can change the redirect url after successful login
// if you have a field as refer_url as hidden field and value is: {http_referer} then
// We can use that as a redirect URL. We will redirect if it's the same domain
@kimcoleman
kimcoleman / pmpro_add_google_tag_manager_to_head.php
Last active January 3, 2024 16:12
Builds the dataLayer and loads GTM tracking in the head. Includes Custom Dimensions and Ecommerce data for Paid Memberships Pro.
<?php
/**
* Builds the dataLayer and loads GTM tracking in the head.
* Includes Custom Dimensions and Ecommerce data.
*
*/
function pmpro_add_google_tag_manager_to_head() {
global $pmpro_pages;
// Don't track admins.
/* https://go.tacodewolff.nl/minify */
enScroll=!1,enFdl=!1,extCurrent=void 0,filename=void 0,targetText=void 0,splitOrigin=void 0;const lStor=localStorage,sStor=sessionStorage,doc=document,docEl=document.documentElement,docBody=document.body,docLoc=document.location,w=window,s=screen,nav=navigator||{},extensions=["pdf","xls","xlsx","doc","docx","txt","rtf","csv","exe","key","pps","ppt","pptx","7z","pkg","rar","gz","zip","avi","mov","mp4","mpe","mpeg","wmv","mid","midi","mp3","wav","wma"];function a(e,t,n,o){const j="G-XXXXXXXXXX",r=()=>Math.floor(Math.random()*1e9)+1,c=()=>Math.floor(Date.now()/1e3),F=()=>(sStor._p||(sStor._p=r()),sStor._p),E=()=>r()+"."+c(),_=()=>(lStor.cid_v4||(lStor.cid_v4=E()),lStor.cid_v4),m=lStor.getItem("cid_v4"),v=()=>m?void 0:enScroll==!0?void 0:"1",p=()=>(sStor.sid||(sStor.sid=c()),sStor.sid),O=()=>{if(!sStor._ss)return sStor._ss="1",sStor._ss;if(sStor.getItem("_ss")=="1")return void 0},a="1",g=()=>{if(sStor.sct)if(enScroll==!0)return sStor.sct;else x=+sStor.getItem("sct")+ +a,sSto
@mihdan
mihdan / README-WordPress-FULLTEXT-Search.md
Created March 24, 2022 16:55 — forked from jesgs/README-WordPress-FULLTEXT-Search.md
WordPress Full Text Search Examples

Adding MySQL FULLTEXT Support to WordPress

FULLTEXT support to WordPress is simple if you have access to phpMyAdmin. If not, it can still be done but is a little trickier if you’re not used to command-line. We’ll demonstrate how to modify your WordPress database using phpMyAdmin.

How To Modify Database

  1. Start out by having a set of keywords to test against. You’ll need ‘before’ and ‘after’ test results. Also, I can’t stress this enough but back up your database before proceeding!

  2. Next, log into your phpMyAdmin page and navigate to your {prefix}_posts table.

  3. Click on the “Structure” tab.

<?php
if (!defined('ABSPATH')) { // Or some other WordPress constant
exit;
}
/**
* Generated by the WordPress Option Page generator
* at http://jeremyhixon.com/wp-tools/option-page/
*/
<h1 id="как-сделать-плавный-скролл-к-любому-положению-на-html-странице">Как сделать плавный скролл к любому положению на html странице</h1>
<h2 id="1-где-скачать-скрипт-плавной-прокрутки-к-любому-положению-на-странице">1. Где скачать скрипт плавной прокрутки к любому положению на странице</h2>
<p><a href="https://gist.githubusercontent.com/artemsites/860cfcd079b1f42cace732c31b5e3a29/raw/scrollSmoothlyToPosition.js">scrollSmoothlyToPosition.js</a></p>
<h2 id="2-как-подлключить-скрипт-js-к-телу-html-документа">2. Как подлключить скрипт js к телу html документа</h2>
<p>Перед закрывающим тегом <code>&lt;/head&gt;</code>
подключаем скрипт плавного скролла <strong>scrollSmoothlyToPosition.js</strong>
и главный скрипт где будем описывать логику <strong>main.js</strong></p>
<pre><code>&lt;head&gt;
...
&lt;script src=&quot;./scrollSmoothlyToPosition.js&quot; defer&gt;&lt;/script&gt;
@rafiahmedd
rafiahmedd / Send Message to whatsapp after submiting the form
Created March 12, 2022 10:37
Send Message to whatsapp after submiting the form
//Method 1
var form = $('#fluentform_1976'); //YOUR FORM ID HERE
form.on('submit',function(){
var firstName = $('#ff_1976_names_first_name_').val(); // YOUR FORM INPUT NAME ID HERE
var lastName = $('#ff_1976_names_last_name_').val(); // YOUR FORM INPUT NAME ID HERE
window.location = 'http://api.whatsapp.com/send?phone=5521997832127&text=Quero-Desenhar%0A%20'+firstName+'%20'+lastName;
});
//Method 2
var firstNameKey = "first_name"; // give your first name fields Name attributes