Skip to content

Instantly share code, notes, and snippets.

View BenRacicot's full-sized avatar
🎯
Focusing

Ben Racicot BenRacicot

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am benracicot on github.
  • I am benracicot (https://keybase.io/benracicot) on keybase.
  • I have a public key ASBKBJ2svvYhwpWSwq3bx57zse0eaexCiGJmKbK2GlPHpgo

To claim this, I am signing this object:

@BenRacicot
BenRacicot / .htaccess
Created March 7, 2018 19:07
Disaalow anyone except your network IP to access wp-admin login page (or any page) via .htaccess file
# Only allow internal IP to access login page
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^xx.xxx.xx.xxx$
RewriteRule ^(.*)$ - [R=403,L]
</IfModule>
@BenRacicot
BenRacicot / Plurilization of words
Created July 22, 2015 19:41
Found this code to pluralize words, nouns to be exact. It included some functions that where not defined so I've added the var 'last' to replace the original function that grabbed the last character.
String.prototype.plural = function () {
// last character
var last = this.charAt(this.length-1);
if (this.last === 'y') {
if ( (this.charAt(this.length - 2)).isVowel() ) {
// If the y has a vowel before it (i.e. toys), then you just add the s.
return this + 's';
}
else {
@BenRacicot
BenRacicot / functions.php
Last active August 29, 2015 14:22
Extending WordPress Plugin DM Confirm Email
add_action( 'init', 'my_ajax_init' );
function my_ajax_init() {
add_action('wp_ajax_nopriv_create_user', 'create_user_function');
add_action('wp_ajax_create_user', 'create_user_function');
}
@BenRacicot
BenRacicot / functions.php
Last active August 29, 2015 13:56
PayPal IPN Script that creates a post in 'Orders_
<?php
// Add this code to functions.php to create a custom table to store order data.
// ALTERNATE
// Use a CPT to create a post each time an order is made.
// require_once('order-post-type.php');
// ALTERNATE
@BenRacicot
BenRacicot / enqueue_script.php
Last active January 3, 2016 22:59
Base AJAX Pagination code
<?php
// Base AJAX Pagination code
//Bad practice: // header.php
function custom_head(){
echo '<script type="text/javascript">var ajaxurl = \''.admin_url('admin-ajax.php').'\';</script>';
}