Skip to content

Instantly share code, notes, and snippets.

View treetop1500's full-sized avatar

Robert Wade treetop1500

  • Gray Loon Marketing Group
  • Salt Lake City, Utah
View GitHub Profile
@treetop1500
treetop1500 / accessibility-console-scripts.js
Last active March 10, 2025 12:48
Accessibility Test Concole Scripts
// Find all elements with click handlers that aren't properly marked as interactive
const allElements = document.querySelectorAll('*');
const problematicElements = Array.from(allElements).filter(el => {
// Get click event listeners if any
const eventListeners = getEventListeners(el);
const hasClickListener = eventListeners && eventListeners.click && eventListeners.click.length > 0;
if (!hasClickListener) return false;
// Check if element is already an interactive element
@treetop1500
treetop1500 / custom-userway-link.html
Last active February 7, 2025 19:15
Custom Userway Link
@treetop1500
treetop1500 / skip-to-main.html
Created February 3, 2025 19:45
Hidden Skip Links
!-- HTML -->
<a href="#main-content" class="skip-link">Skip to main content</a>
<nav>
<!-- Your navigation content -->
</nav>
<main id="main-content" tabindex="-1">
<!-- Your main content -->
</main>
@treetop1500
treetop1500 / middleware.js
Created September 17, 2024 22:51
NextJS Middleware
import { NextResponse } from 'next/server';
export const config = {
matcher: ['/'],
};
const THRESHOLD = 0.5;
const COOKIE_NAME = 'tm_var';
export function middleware(req) {
@treetop1500
treetop1500 / middleware.js
Created August 20, 2024 21:12
NextJS Middleware Javascript
import { NextResponse } from 'next/server';
export const config = {
matcher: ['/'],
};
const THRESHOLD = 0.5;
const COOKIE_NAME = 'tm_var';
export function middleware(req) {
@treetop1500
treetop1500 / darkmode.js
Created March 17, 2022 21:45
Recaptcha and Mapkit Dark Mode swapping with Javascript
// Recaptcha HTML: <div class="g-recaptcha" data-sitekey="{{ site_key }}" data-theme="dark" id="recaptcha"></div>
// MapKit HTML: <div id="map" class="h-full"></div>
// (also requires installation of mapkit.js and recaptcha.js scripts)
var recpatcha = document.getElementById('recaptcha')
var mapKitColorMode = "light";
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
recpatcha.setAttribute('data-theme', 'dark');
mapKitColorMode = "dark"
Fix for FOUC :
**At the top of your HTML:**
<!doctype html>
<html>
<head>
<style>html{visibility: hidden;opacity:0;}</style>
@treetop1500
treetop1500 / issues.txt
Created November 7, 2018 19:12
Issue Label Master List
analytics
bug
ui/ux problem
enhancement
hold
duplicate
enhancement
help wanted
need client feedback
need client info
@treetop1500
treetop1500 / AdminDashboardController.php
Created September 18, 2018 16:16
Easy Admin Controller Extension with Google Analytics Dashboard
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Request;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AdminController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Google_Client;
use Google_Service_AnalyticsReporting;
class AdminDashboardController extends AdminController
@treetop1500
treetop1500 / pre-commit
Created September 4, 2018 16:10
Git pre-commit hook for running phpunit functional and unit tests.
#!/usr/local/bin/php
<?php
echo "Running tests.. ";
exec('bin/phpunit', $output, $returnCode);
if ($returnCode !== 0) {
// Show full output
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL;
echo "Aborting commit.." . PHP_EOL;
exit(1);