git init
git remote add origin [email protected]:...GITHUB_URL...
git fetch
git checkout -f main
git remote -v
Then
git pull
aws ec2 describe-instances --filters 'Name=tag:Name,Values=NAME_GOES_HERE' --query 'Reservations[].Instances[].[InstanceId][0][0]' |
server { | |
location ~ /\.git { | |
return 404; | |
} | |
location ~\.(git|md)$ { | |
return 404; | |
} | |
} |
// Format number to X decimal places. | |
function numberFormat(number, minimumFractionDigits = 0) { | |
return new Intl.NumberFormat('en', { minimumFractionDigits }).format(number); | |
} |
/** | |
* Manually test WordPress database connection. Return useful errors upon failure. | |
*/ | |
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); | |
if ($mysqli->connect_errno) { | |
die("❌ Failed to connect to MySQL: {$mysqli->connect_error}"); | |
} | |
if ($result = $mysqli->query("SELECT * FROM `{$table_prefix}options`")) { | |
echo "✅ Connection OK. Returned rows are: {$result->num_rows}"; | |
$result->free_result(); |
git init
git remote add origin [email protected]:...GITHUB_URL...
git fetch
git checkout -f main
git remote -v
Then
git pull
const days = Array(7) | |
.fill(new Date()) | |
.map((el, i) => | |
new Date(el.setDate(el.getDate() - el.getDay() + i)) | |
.toLocaleString('en', { weekday: 'short' })) // change 'en' for different locales, or 'short'/'long' for short/long weekday titles | |
.map((label, value) => { | |
return { | |
value, | |
label, | |
} |
// Formatted in D MMMM YYYY | |
// Eg; 18 October 2022 | |
`${(new Date().getDate())} ${(new Date().toLocaleString("en", { month: "long" }))} ${(new Date().getFullYear())}` | |
// Formatted in D{ordinal} MMMM YYYY | |
// Eg; 18th October 2022 | |
`${(new Date().getDate())}${{one:'st',two:'nd',few:'rd',other:'th'}[new Intl.PluralRules('en-GB', { type: 'ordinal' }).select(new Date().getDate())]} ${(new Date().toLocaleString("en", { month: "long" }))} ${(new Date().getFullYear())}` | |
// Formatted in DD-MM-YYYY | |
// Eg; 18-09-2022 |
As per this post dated back from 2015, there is an issue with Github caching images you've embedded in markdown, eg README.md files.
This script is a PHP cron that accepts an array of images & clears their cache.
It should be run at a fairly sensible interval that clears the cache of the image(s) you've specified.
sudo nano .zshrc |
I find PR's that have been approved or have requested changes difficult to spot in the list of other PR's on Github. This CSS fixes that, by highlighting those that are approved in green & requested changes in red.
The custom CSS can be applied by a Chrome or other browser extenion such as Stylebot or Amino Editor.
Before | After |
---|---|
![]() |
![]() |