Skip to content

Instantly share code, notes, and snippets.

@jralph
jralph / cloudfront-basic-auth-handler.js
Last active December 18, 2025 13:17
CloudFront Function for Basic Auth with KVS and IP Whitelisting
// Hard-coded IP whitelist (IP addresses or CIDR ranges)
const IP_WHITELIST = [
'203.0.113.0/24', // Example CIDR range
'198.51.100.42', // Example single IP
'2001:db8::/32', // Example IPv6 CIDR
];
// AWS CloudFront KVS ID
const KVS_ID = 'your-kvs-id'; // Replace with your KVS ID
@jralph
jralph / resume.json
Last active February 26, 2025 13:30
{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Joseph Ralph",
"label": "Platform Reliabilty Engineer (SRE/DevOps)",
"picture": "https://gravatar.com/avatar/6bd0e9e25fb7cd4f1b2f43c1372d5771?s=400&d=robohash&r=x",
"email": "josephralph4@gmail.com",
"phone": "",

Keybase proof

I hereby claim:

  • I am jralph on github.
  • I am jralph (https://keybase.io/jralph) on keybase.
  • I have a public key whose fingerprint is 9EEF DE39 A4A7 9A95 E28D 5217 6170 AB96 50CF 53D7

To claim this, I am signing this object:

@jralph
jralph / jquery-tabs-accordion.html
Created July 24, 2014 22:41
jQuery-Tabs Accordion
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery-Tabs as an Accordion</title>
<style>
* {
box-sizing: border-box;
}
@jralph
jralph / config.inc.php
Created April 23, 2014 10:11
PHPMyAdmin Remote Connect
<?php
/**
* Add the below to your config.inc.php in the phpmyadmin directory.
*/
$i++;
$cfg['Servers'][$i]['host'] = 'host:port';
$cfg['Servers'][$i]['user'] = 'username';
$cfg['Servers'][$i]['password'] = 'password';
$cfg['Servers'][$i]['password'] = 'config';
@jralph
jralph / wp-config.php
Created April 23, 2014 10:09
WordPress - More Dynamic Site And Home URL for LocalHost
<?php
/**
* Define custom site urls so the blog works on multiple server setups
* Add the below code to wp-config.php
*/
if ($_SERVER['HTTP_HOST'] == 'localhost') {
$root = $_SERVER['DOCUMENT_ROOT'];
$file = str_replace('\\', '/', dirname(__FILE__));
$path = str_replace($root, '', $file);
define('WP_HOME', 'http://localhost'.$path);
<?php
/**
* The errors class is used to check if any errors have been activated and display them.
* It also has a specific function to set an error to be displayed when the user next
* loads the page.
*
* @author Joseph Ralph <jralph@arrowvaleacademy.co.uk>
*
*/
<?php
/**
* The errors class is used to check if any errors have been activated and display them.
* It also has a specific function to set an error to be displayed when the user next
* loads the page.
*
* @author Joseph Ralph <jralph@arrowvaleacademy.co.uk>
*
*/
<?php
// A simple validation class to check form inputs.
class Validate {
// Check email to make sure it contains the @ symbol.
public static function email($email)
{
// Check if $email is blank, if so, return false.
if($email != '' && $email != ' '){
<?php
// Initlate files delete class.
class FilesDelete_Model extends Base_Model {
// Function to delete files.
public function delete($file)
{
// Delete requested file.
Files::delete_file($file);