Skip to content

Instantly share code, notes, and snippets.

View JimWestergren's full-sized avatar

Jim Westergren JimWestergren

View GitHub Profile

Keybase proof

I hereby claim:

  • I am JimWestergren on github.
  • I am jimwestergren (https://keybase.io/jimwestergren) on keybase.
  • I have a public key whose fingerprint is 9EC1 412F CF0F CC49 59F5 CC72 8332 DA72 58C7 0350

To claim this, I am signing this object:

@JimWestergren
JimWestergren / pdo-vs-mysqli.php
Last active October 31, 2017 08:29
Test the speed of PDO versus MySQLi
<?php
/* Script to test the speed of PDO versus MySQLi
* Written by Jim Westergren, info https://www.jimwestergren.com/pdo-versus-mysqli
* I release this code to public domain.
* Please give attribution by name and link but not required
*/
define('MYSQL_HOST', '');
define('MYSQL_USERNAME', '');
define('MYSQL_PASSWORD', '');
define('MYSQL_DATABASE', '');
@JimWestergren
JimWestergren / index-with-redis.php
Last active February 11, 2023 18:28
Redis as a Frontend Cache for WordPress
<?php
/*
Author: Jim Westergren & Jeedo Aquino
File: index-with-redis.php
Updated: 2012-10-25
This is a redis caching system for wordpress.
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
@JimWestergren
JimWestergren / checkPawnedPasswords.php
Last active December 22, 2023 23:06
Simple method to check the Pwned Passwords API using PHP
<?php
/**
* Simple method to use the API from https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/
* Written by Jim Westergren and released to public domain
* @return int count
*/
function checkPawnedPasswords(string $password) : int
{
$sha1 = strtoupper(sha1($password));
$data = file_get_contents('https://api.pwnedpasswords.com/range/'.substr($sha1, 0, 5));