Skip to content

Instantly share code, notes, and snippets.

Avatar

Austin Crane accrane

View GitHub Profile
View cus.js
let myTitles = Array.prototype.slice.apply(document.querySelectorAll("h2.woocommerce-loop-product__title"));
const searchTerm = '(';
// console.log( myTitles );
const regExp = /\(([^)]+)\)/;
myTitles.forEach((myTitles) => {
//console.log("apply worked");
if( myTitles.innerHTML.indexOf(searchTerm) > -1 ) {
// console.log('yep');
View delete-post-revisions.sql
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'
@accrane
accrane / menus.scss
Created Feb 1, 2018
Animated underline on Navigation
View menus.scss
a {
display: block;
text-decoration: none;
color: #000;
position: relative;
padding: 0 10px;
&:before {
content: "";
View force-https.htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
View google-captcha-disable-submit-button.html
<script type="text/javascript">
jQuery(document).ready(function ($) {
// disable the button until successfull google captcha
document.getElementById("button1").disabled = true;
document.getElementById("button2").disabled = true;
})(jQuery);
</script>
View google-captcha-enable-submit.html
<script type="text/javascript" language="JavaScript">
// Callback to get the button working.
function enableBtn1(){
document.getElementById("button1").disabled = false;
}
function enableBtn2(){
document.getElementById("button2").disabled = false;
}
</script>
@accrane
accrane / google-captcha-render.html
Created Apr 14, 2017
rendering the Google Captcha
View google-captcha-render.html
<script type="text/javascript" language="JavaScript">
// Call to rendor the captcha
var recaptcha1;
var recaptcha2;
var myCallBack = function() {
//Render the recaptcha1 on the element with ID "recaptcha1"
recaptcha1 = grecaptcha.render('recaptcha1', {
//'sitekey' : '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', //test key
'sitekey' : 'YOUR_SITE_KEY', // production
@accrane
accrane / google-captcha-form.html
Created Apr 14, 2017
the form setup for Google Captcha V2
View google-captcha-form.html
<div class="form-wrap">
<!-- Form 1 -->
<form id="form-1">
<!--
Other form elements...
-->
<!-- insert the google captcha div with the ID of "recaptcha1" -->
<div id="recaptcha1" class="googlecapt"></div>
<!-- Give your submit button an ID of "button1" -->
@accrane
accrane / google-captcha-v2.html
Created Apr 14, 2017
Google Captcha V2 page setup
View google-captcha-v2.html
<!DOCTYPE html>
<html>
<head>
<title>Google Captcha v2</title>
<script type="text/javascript" language="JavaScript">
// Callback to get the button working.
function enableBtn1(){
document.getElementById("button1").disabled = false;
@accrane
accrane / change-first-word.js
Created Mar 6, 2017
jQuery solution to changing the styling of the first word
View change-first-word.js
/*
*
* Make first word in date underlined
*
------------------------------------*/
$('.js-first-word').each(function(index, element) {
var heading = $(element);
var word_array, last_word, first_part;
word_array = heading.html().split(/\s+/); // split on spaces
You can’t perform that action at this time.