Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
woodwardtw / get-convo.js
Created March 3, 2026 16:18
Gemini conversation bookmarklet
javascript:(()=>{ const turns = [...document.querySelectorAll('user-query, model-response')]; if (!turns.length) { alert('No conversation found — check selectors in DevTools.'); return; } const md = turns.map(el => { const role = el.tagName === 'USER-QUERY' ? %27## Student' : '## Gemini'; return %60${role}\n\n${el.innerText.trim()}%60; }).join('\n\n---\n\n'); navigator.clipboard.writeText(md) .then(() => alert(%60Copied ${turns.length} turns to clipboard.%60)) .catch(() => alert('Clipboard access denied — try clicking the bookmarklet again.'));})();
Анна: Привет, Иван! Как дела?
Иван: Привет, Анна! Всё хорошо, спасибо. А у тебя?
Анна: Тоже неплохо. Ой, я так хочу есть! Ты голоден?
Иван: Да, очень! Я думаю только о еде. Что мы будем есть?
Анна: Хм, я не знаю. У нас есть курица и рис.
@woodwardtw
woodwardtw / tellmeyoursecrets.js
Last active September 9, 2025 14:52
google script that lists a lot of info about the files in a particular folder/sub folder structure including viewers, editors, and sharing permissions
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
var folder = DriveApp.getFolderById("YOUR_FOLDER_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
var files = folder.getFiles();//initial loop on loose files w/in the folder
var cnt = 0;
var file;
@woodwardtw
woodwardtw / making_records.php
Last active May 6, 2025 17:09
CSV to WP custom post types and custom fields - triggered by visiting http://yoururl.org/?run_my_script once you've turned it on as a plugin
<?php
/**
* Plugin Name: Make Records
* Plugin URI: https://github.com/woodwardtw/
* Description: Parses CSV to make records
* Version: 1.1
* Author: Tom Woodward
* Author URI: http://bionicteaching.com
* License: GPL2
*/
@woodwardtw
woodwardtw / block_json.php
Created April 12, 2025 12:45
Put block patterns in rest API for WordPress
add_action( 'rest_api_init', function () {
register_rest_route( 'custom/v1', '/patterns/', [
'methods' => 'GET',
'callback' => function( $request ) {
$pattern_name = $request->get_param( 'name' );
$pattern_title = $request->get_param( 'title' );
$registry = WP_Block_Patterns_Registry::get_instance();
$patterns = array_values( $registry->get_all_registered() );
// Filter by name if provided
@woodwardtw
woodwardtw / Google Map Marker LatLong
Last active January 28, 2025 20:26
A draggable Google Map marker that auto locates and updates on maker drag
<!DOCTYPE html>
<html>
<head>
<title>Geolocation</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0px;
@woodwardtw
woodwardtw / gs_journal.js
Last active August 26, 2024 17:39
A Google Script for creating docs and journal entries from a form submission.
//this function is set to run on each form submit and is tied to the spreadsheet where the entries go
function onSubmit(){
let sheet = SpreadsheetApp.getActiveSheet();
let rows = sheet.getDataRange();
let lastRow = rows.getLastRow();
let email = sheet.getRange(lastRow,2).getValue();
let atSymbol = email.search('@');
let cleanEmail = email.substring(0,atSymbol);
let title = sheet.getRange(lastRow,3).getValue();
let content = sheet.getRange(lastRow,4).getValue();
section.part header h1, section.front-matter header h1.entry-title, section.back-matter header h1.entry-title,
.front-matter h5,
.part h5,
.chapter h5,
.back-matter h5,
body#tinymce.wp-editor h5,
.front-matter h2,
.part h2,
.chapter h2,
.back-matter h2,
@woodwardtw
woodwardtw / french_time_dropdowns.js
Created April 23, 2024 13:12
A Google script to dynamically change the data validation rules based on the selection from another cell.
function onEdit(){
const ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const entries = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("entries");
const dropDowns = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("dropdowns");
const activeCell = entries.getCurrentCell();
const activity = activeCell.getValue();
if(activeCell.getColumn() == 3 && activeCell.getRow() > 1){
activeCell.offset(0,1).clearContent().clearDataValidations();
@woodwardtw
woodwardtw / index.php
Created January 26, 2024 15:19
example helper plugin for Skidmore
<?php
/*
Plugin Name: Skidmore Multisite Helpers
Plugin URI: https://github.com/
Description: A network activated plugin used to house small functions that apply to all sites.
Version: 1.0
Author: Tom Woodward et al.
Author URI: https://tomwoodward.us
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html