Skip to content

Instantly share code, notes, and snippets.

View DuckDivers's full-sized avatar

Howard DuckDivers

  • Duck Diver Marketing
  • Florida
View GitHub Profile
@DuckDivers
DuckDivers / set-datepicker-date.js
Created June 26, 2020 14:16
Set value of datepicker date to Month day, Year
jQuery(document).ready(function (e) {
var t = new Date(),
a = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"),
n = t.getDate(),
i = t.getMonth(),
r = t.getFullYear(),
d = a[i] + " " + n + ", " + r;
e('input[name="trip-date"]').val(d);
var o = e(".datepicker").datepicker({
numberOfMonths: 1,
@DuckDivers
DuckDivers / country-list.txt
Created June 24, 2020 16:23
Contact Form 7 List of Countries
[select country "United States" "Canada" "Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antigua and Barbuda" "Argentina" "Armenia" "Armenia" "Aruba" "Australia" "Austria" "Azerbaijan" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" "Barbados" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bonaire" "Bosnia and Herzegovina" "Botswana" "Bouvet Island (Bouvetoya)" "Brazil" "British Indian Ocean Territory (Chagos Archipelago)" "British Virgin Islands" "Brunei Darussalam" "Bulgaria" "Burkina Faso" "Burundi" "Cambodia" "Cameroon" "Cape Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Cocos (Keeling) Islands" "Colombia" "Comoros" "Congo" "Congo" "Cook Islands" "Costa Rica" "Cote d'Ivoire" "Croatia" "Cuba" "Curacao" "Cyprus" "Cyprus" "Czech Republic" "Denmark" "Djibouti" "Dominica" "Dominican Republic" "Ecuador" "Egypt" "El Salvador" "Equatorial Guinea" "Eritrea" "Estonia" "Ethiopia" "Falkland Islands (Malvinas)" "Faroe I
@DuckDivers
DuckDivers / jquery-is-function.js
Created January 25, 2020 11:33
jquery check if is function before executing
if ( $.isFunction($.fn.datepicker) ) {
$('input.datepicker').datepicker({
// The format you want
altFormat: "yy-mm-dd",
// The format the user actually sees
dateFormat: "M dd, yy",
changeYear: true,
changeMonth: true
});
}
@DuckDivers
DuckDivers / states.js
Created December 31, 2019 20:45
Choose State / Province from JSON file
$('#country').change(function(){
// Clear previous Choices
$('#state').html();
var country = $(this).val();
var json_file;
var states;
if (country === 'US'){
json_file = 'states.json';
states = 'State'
} else if (country === 'CA'){
@DuckDivers
DuckDivers / cf7-extra.js
Created September 26, 2019 22:01
Prevent Contact Form 7 - Multiple Submissions
// Prevent Multiple Clicks on Contact Form 7 Submissions
jQuery(document).on('click', '.wpcf7-submit', function(e){
if( jQuery('.ajax-loader').hasClass('is-active') ) {
e.preventDefault();
return false;
}
});
@DuckDivers
DuckDivers / basic-cf7-bootstrap-layout.html
Last active February 19, 2019 01:06
Basic 3 Column layout for contact form 7
<div class="row">
<div class="col-sm-4">[text* your-name placeholder "Name:"] </div>
<div class="col-sm-4">[email* your-email placeholder "E-mail:"] </div>
<div class="col-sm-4">[text your-phone placeholder "Phone:"] </div>
</div>
<div class="row">
<div class="field col-12">[textarea your-message placeholder "Message:"] </div>
</div>
<div class="submit-wrap">
<input type="reset" value="clear" class="btn btn-primary" />
/*!
* Bootstrap Grid v4.1.2 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/.container,.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto;width:100%}.flex-column,.flex-row{-webkit-box-direction:normal!important}@-ms-viewport{width:device-width}html{-webkit-box-sizing:border-box;box-sizing:border-box;-ms-overflow-style:scrollbar}*,::after,::before{-webkit-box-sizing:inherit;box-sizing:inherit}@media (min-width:576px){.container{max-width:540px}}@media (min-width:768px){.container{max-width:720px}}@media (min-width:992px){.container{max-width:960px}}@media (min-width:1200px){.container{max-width:1140px}}.bsrow{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.no-gutters{margin-right:0;margin-left:0}.no-gutters>.col,.no-gutters>[class*=col-]{padding-right:0;pa
@DuckDivers
DuckDivers / affix.css
Created June 7, 2018 14:59
Bootstrap 4 Affix - Add data-toggle="affix" to element
.affix {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030;
}
/* fixed to top styles */
.affix.navbar {
@DuckDivers
DuckDivers / gist:eb663a24000ebda04f41951130deb50d
Created May 19, 2018 10:49
Prevent Plugin from Updating
<?php
// Add to Plugin main file
add_filter('site_transient_update_plugins', 'dd_remove_update_nag');
function dd_remove_update_nag($value) {
unset($value->response[ plugin_basename(__FILE__) ]);
return $value;
}
@DuckDivers
DuckDivers / class.database.php
Created August 3, 2017 15:16 — forked from jonashansen229/class.database.php
PHP OOP Database class using MySQLI and Singleton pattern. Only one instance of the class will be made, this requires less memory.
<?php
/*
* Mysql database class - only one connection alowed
*/
class Database {
private $_connection;
private static $_instance; //The single instance
private $_host = "HOSTt";
private $_username = "USERNAME";
private $_password = "PASSWORd";