Skip to content

Instantly share code, notes, and snippets.

View thedavecarroll's full-sized avatar
🧑‍💻
Clever Status

Dave Carroll thedavecarroll

🧑‍💻
Clever Status
View GitHub Profile
@thedavecarroll
thedavecarroll / Add-TimeSpan.sp1
Created August 10, 2022 08:11
Simple function to add timespan
function Add-TimeSpan {
[CmdLetBinding(DefaultParameterSetName='TimeSpan')]
param(
[Parameter()]
[datetime]$Timestamp = (Get-Date),
[Parameter(Mandatory,ParameterSetName='TimeSpan')]
[timespan]$TimeSpan,
[Parameter(ParameterSetName='TimeSlice')]
[int]$Days,
[Parameter(ParameterSetName='TimeSlice')]
@thedavecarroll
thedavecarroll / cibuild
Last active September 9, 2022 05:29
Recent Changes to the Site - thedavecarroll.com
#!/usr/bin/env bash
set -e # halt script on error
echo
echo "------------------------------------------------------------------------------------------------------------------------"
echo
if [ "$TRAVIS_PULL_REQUEST" != "false" -a "$TRAVIS_BRANCH" == "comments" ]; then
echo "Building site for pull request for $TRAVIS_BRANCH..."
echo
@thedavecarroll
thedavecarroll / Join-OxfordComma.ps1
Last active November 19, 2022 04:23
The Join-OxfordComma command can provide you a comma separated list using the Oxford comma and either 'and' or 'or'.
function Join-OxfordComma {
[CmdletBinding(DefaultParameterSetName='And')]
[Alias('jox')]
param(
[Parameter(Mandatory,ValueFromPipeline)]
[string[]]$JoinList,
[Parameter(ParameterSetName='And')]
[switch]$And,
[Parameter(ParameterSetName='Or')]
[switch]$Or
@thedavecarroll
thedavecarroll / db_functions.inc.php
Last active January 12, 2025 02:46
MySQL DB Functions for PHP - OLD CODE EXAMPLE
<?php
// ----------------------------------------------------------------------------
$db_insert_rows = 0;
$db_update_rows = 0;
$db_select_all = "SELECT * FROM $mysql_table";
function db_connect() {
global $db_host, $db_user, $db_pass, $db_database;
$db_link = mysql_connect($db_host, $db_user, $db_pass)