This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* `favicon.php` - Dynamically generate a favicon image with background color and text overlay | |
*/ | |
$fallback = 'favicon.ico'; | |
if ( file_exists( $fallback ) ) { | |
// use a favicon.ico if available | |
header( "Location: $fallback" ); | |
die( "Redirecting to $fallback" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_shutdown_function('handleShutdown'); | |
function handleShutdown() { | |
$lastError = error_get_last(); | |
if (null !== $lastError) { | |
switch ($lastError['type']) { | |
case E_ERROR: | |
case E_PARSE: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Variables to set the starting position and increment. | |
xPos=60 | |
yPos=60 | |
increment=30 | |
# Save the active window id for later. | |
active_window_id=$(xdotool getactivewindow) | |
active_window_id_hex=$(printf "0x%08x" "$active_window_id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns the first element that matches the specified CSS selector within the document. | |
* | |
* @function $ | |
* @param {string} selector - The CSS selector used to select the element. | |
* @returns {Element|null} The first element that matches the selector, or null if no elements are found. | |
*/ | |
let $ = document.querySelector.bind(document); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Requirements | |
if ! command -v docker &> /dev/null; then | |
echo 'Please install docker: https://docs.docker.com/engine/install/' | |
exit 1 | |
fi | |
if ! command -v ngrok &> /dev/null; then | |
echo 'Please install ngrok: https://ngrok.com/download' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.tri-layout-container .tri-layout-middle { | |
padding-top: 0 !important; | |
} | |
.content-wrap.card { | |
padding: 4px 16px !important; | |
} | |
.content-wrap.card h2 { | |
font-size: 1.25rem !important; | |
} | |
.tri-layout-left-contents, .tri-layout-right-contents { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// mock get_option / update_option using global state | |
require_once( 'mock.php' ); | |
/** | |
* Timestamp a value. | |
* update_option( $name, stamp( $value ) ); | |
* | |
* @param int|null $timestamp now, or provided time() compatible timestamp. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# filename: ~/bin/git-sw | |
# example: git sw 930 | |
# example: git sw origin/JIRA-2 | |
# | |
# Fuzzy switch | |
# TODO: Does not handle remotes other than origin. | |
# Check branch locally | |
BRANCH=$(git branch | grep $1 | head -n1 | xargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import os | |
import re | |
import requests | |
import subprocess | |
import unicodedata | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
update_apt() { | |
if ! command -v apt-get &> /dev/null | |
then | |
return | |
fi | |
echo; | |
echo ">>> Updating apt-get packages..." | |
sudo apt-get update -qq |
NewerOlder