Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim Westergren JimWestergren

View GitHub Profile
@JimWestergren
JimWestergren / checkPawnedPasswords.php
Last active Mar 9, 2020
Simple method to check the Pwned Passwords API using PHP
View checkPawnedPasswords.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));
@JimWestergren
JimWestergren / pdo-vs-mysqli.php
Last active Oct 31, 2017
Test the speed of PDO versus MySQLi
View pdo-vs-mysqli.php
<?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', '');
View keybase.md

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 / index-with-redis.php
Last active Jun 27, 2019
Redis as a Frontend Cache for WordPress
View index-with-redis.php
<?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/
You can’t perform that action at this time.