Skip to content

Instantly share code, notes, and snippets.

View JezDriver's full-sized avatar

Jeremy Driver JezDriver

View GitHub Profile
@JezDriver
JezDriver / prompt-colours.sh
Created January 9, 2026 01:43
Variables for outputting text with nice colours #bash
# Include this in your bash profile with:
# source "/path/prompt-colours.sh"
# -------
# Colours
# -------
# Reset
NC='\033[0m' # Text Reset
@JezDriver
JezDriver / is-new-session.php
Created June 24, 2025 01:47
Check if a session exists and a variable has been set #php
<?
function isNewSession() {
if(session_id() == '' || !isset($_SESSION) || session_status() === PHP_SESSION_NONE) {
// session isn't started
session_set_cookie_params(3600,"/"); // 1 hour
session_start();
}
if (!isset($_SESSION['new_session'])) {
$_SESSION['new_session'] = true;
@JezDriver
JezDriver / shine-effect.scss
Last active March 26, 2025 01:22
Shine effect #css
body {
background: #222;
}
.btn {
position: relative;
display: inline-block;
background: transparent;
color: gold;
border: 2px solid;
@JezDriver
JezDriver / animations.scss
Last active March 25, 2025 05:44
Peekaboo - animate elements when they enter the viewport #js #css #scss
[data-peekaboo="fadeinup"] {
transition: 1.5s ease;
transition-property: opacity, transform;
// Animations runs automatically if there's no JS
&:not(.visible, html.no-js *) {
opacity: 0;
transform: translateY(1em);
}
}
@JezDriver
JezDriver / google-sheets-exclude-range-from-other-range.md
Created August 16, 2024 04:56
Exclude a range from another range, returning the initial range without items in the second #gsheets
@JezDriver
JezDriver / dev-tools-broken-link-checker.js
Created August 1, 2024 06:32
Check broken links using dev tools #js
@JezDriver
JezDriver / use-video-as-poster.html
Created August 1, 2024 02:53
Use a video as only a poster without preloading the video itself #html
<!-- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#preload -->
<video muted preload="metadata">
<source src="/blah.mp4" type="video/mp4">
</video>
@JezDriver
JezDriver / get-scrollbar-width.js
Created July 17, 2024 03:18
Get the scrollbar width and puts it in a custom property
// https://stackoverflow.com/a/57748743
document.documentElement.style.setProperty('--scrollbar-width', (window.innerWidth - document.documentElement.clientWidth) + "px");
@JezDriver
JezDriver / type-iso-date.scpt
Created February 29, 2024 23:05
Applescript to type the current date in ISO format (YYYY-MM-DD)
on run {input, parameters}
set {year:y, month:m, day:d} to (current date)
# pad the day and month if single digit
set day_str to text -1 thru -2 of ("00" & d)
set mon_str to text -1 thru -2 of ("00" & (m * 1))
# make ISO8601 date string without time
set thedate to (y & "-" & mon_str & "-" & day_str) as string
tell application "System Events"
keystroke thedate
@JezDriver
JezDriver / flush-dns-cache-macos.sh
Created February 29, 2024 01:16
Flush the DNS cache on MacOS #terminal
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder