Skip to content

Instantly share code, notes, and snippets.

View richjenks's full-sized avatar
🏍️

Rich Jenkins richjenks

🏍️
View GitHub Profile
@richjenks
richjenks / gmail.php
Last active April 29, 2020 23:16
Send email using a PHP 5.5 Generator and cURL
class Gmail {
private $mail;
private $email;
private $pass;
public function __construct($email, $pass){
$this->email = $email;
$this->pass = $pass;
}
@richjenks
richjenks / web.config
Created December 13, 2014 08:57
GetSimple fancy URLs on IIS Windows Server
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<rewrite>
<rules>
<rule name="GetSimple Fancy URLs" stopProcessing="true">
<match url="/?([A-Za-z0-9-_]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
@richjenks
richjenks / free-email-providers
Last active June 10, 2024 13:50
Send suggested domains to [email protected]
.ddns.org
.findhere.com
.freeservers.com
.zzn.com
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
@richjenks
richjenks / flatten-array.php
Last active August 29, 2015 14:13
Flatten array and convert $_POST array into the HTML names that would create it
/**
* post2name
*
* Converts a $_POST array to a flat array of the form element `name`s which would have produced it.
*
* For example, the PHP array:
*
* 'foo' => 'bar',
* 'baz' => [
* 'foo' => 'bar',
@richjenks
richjenks / redirect-to-canonical.js
Created January 21, 2015 10:25
Redirect to canonical
if (document.querySelector("link[rel='canonical']")) {
// Get current URL
var url = document.URL;
// If query string, get it and append to current URL
if (location.search) {
var query = location.search;
} else {
var query = '';
@richjenks
richjenks / wp-debug.php
Created January 23, 2015 12:03
WP_DEBUG in JavaScript
add_action( 'wp_head', function () {
echo '<script>var WP_DEBUG = ';
echo ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? 'true' : 'false';
echo ';</script>';
} );
@richjenks
richjenks / empty-title.html
Created January 29, 2015 10:32
Hide HTML Title
<title>&lrm;</title>
@richjenks
richjenks / composer.json
Last active August 29, 2015 14:16
Composer config for WordPress Packagist (http://wpackagist.org/)
{
"repositories": [
{
"type": "composer",
"url": "http://wpackagist.org"
}
],
"autoload": {
"files": [
"vendor/plugin-folder/plugin.php"
@richjenks
richjenks / reset-dropdown.js
Last active April 16, 2016 07:39
Reset select element to default value
var field = jQuery("#ninja_forms_field_196");
field.val(field.find("[selected]").val());
@richjenks
richjenks / encrypt-decrypt.php
Last active January 13, 2025 17:18
Simple PHP Encryption & Decryption
<?php
/**
* Simple PHP Encryption functions
*
* Attempts to be as secure as possible given:
*
* - Key can be any string
* - No knowledge of encryption is required
* - Only key and raw/encrypted string is needed at each end