Skip to content

Instantly share code, notes, and snippets.

View cbirdsong's full-sized avatar

Cory Birdsong cbirdsong

View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active February 17, 2025 22:17
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
<?php
/**
* Optimize Content Hero Image WordPress Plugin.
*
* @package OptimizeContentHeroImage
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2023 Google Inc.
*
* @wordpress-plugin
@isaumya
isaumya / remove_unused_gutenberg_block.md
Created October 25, 2022 08:18
Remove the unnecessary/unused Gutenberg blocks and block variations

Remove Unused Gutenberg Blocks and Block Variations

When creating custom WordPress themes, we often create custom Gutenberg blocks as per the website design and development need. As a result the list of available block keep getting increased and sometimes it gets really hard to quickly find the block you are looking for. WordPress being a great CMS, it comes with a lot of in-built core blocks, but not all website need them or use them.

So, if you are also building a custom WordPress theme where you would like to unregister some of the default Gutenberg blocks that WordPress ships with you can do that easily by following the steps below.

⚠️ Note: Read the code first and then only unregister the blocks you don't want. Don't blindly copy paste the code.

Setp 1 — Create editor.js inside your theme

Create a JavaScript file inside your WordPress theme. You can name the file whatever you like and also put it whereever you prefer inside your theme file structure. Here for example, I've named the file `

@dimkaram
dimkaram / advanced_circadian_lighting.yaml
Last active November 9, 2024 19:06
Homeassistant Automation Blueprint for Advanced Circadian Lighting
blueprint:
# INTRODUCTION
name: Advanced Circadian Lighting
description: >-
This automation adjusts light brightness, temperature, and color hue,
based on presence, current time and sun position.
@dwhenson
dwhenson / .stylelintrc.json
Created July 1, 2021 11:43
Stylelint Config
{
"plugins": ["stylelint-order", "stylelint-scss"],
"defaultSeverity": "warning",
"rules": {
"at-rule-empty-line-before": [
"always",
{
"except": ["blockless-after-same-name-blockless", "first-nested"],
"ignore": ["after-comment", "first-nested", "blockless-after-same-name-blockless"]
}
@tigt
tigt / git-branch-to-favicon.js
Created March 18, 2020 21:10
Creates an SVG string that can be used as a favicon across different Git branches. Actually getting this into the browser is sadly project-specific.
const { execSync } = require('child_process')
const { createHash } = require('crypto')
const invertColor = require('invert-color')
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
const hash = createHash('sha256')
hash.update(branchName)
const color = '#' + hash.digest().toString('hex').substring(0, 6)
const invertedColor = invertColor(color, true)
@alexander-young
alexander-young / functions.php
Created January 15, 2020 05:27
Cleanup WordPress plugin admin
// Removing plugin controls from admin
function remove_plugin_controls($actions, $plugin_file, $plugin_data, $context){
if (array_key_exists('edit', $actions)) {
unset($actions['edit']);
}
if (array_key_exists('deactivate', $actions)) {
@vividvilla
vividvilla / osxtweaks
Created January 8, 2020 10:45 — forked from webdevbrian/osxtweaks
Brian's List of OSX Tweaks for web developers
#OSX Tweaks:
===========
- Most need reboot to show changes
- Most of these tweaks are just for speed, but some are specific for development
- All of these are to be ran in terminal. The commands to be copy and pasted start after the less-than sign.
- I'm not responsible for any adverse effects to your computer, at all.
##Increase the speed of OS X dialogs boxes:
@samkent
samkent / dequeue-tribe-events-styles-scripts.php
Last active June 21, 2024 16:45
Dequeue Tribe Events (The Events Calendar) scripts and styles if not calendar or event page
<?php
/**
* Detect Tribe Events page
* @link https://wordpress.stackexchange.com/questions/340515/writing-a-function-to-detect-an-event
*/
function is_tribe_calendar() {
if (tribe_is_event() || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' )) {
return true;
}
else {
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active February 12, 2025 20:50
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {