Skip to content

Instantly share code, notes, and snippets.

View GarySwift's full-sized avatar

Gary Swift GarySwift

  • Waterford City, Ireland
View GitHub Profile
@GarySwift
GarySwift / _taxonomy.php
Created December 5, 2017 11:15
Custom taxonomy hide meta box but show in menu
<?php
function cptui_register_my_taxes_region() {
/**
* Taxonomy: Regions.
*/
$labels = array(
"name" => __( "Regions", "twentyseventeen" ),
"singular_name" => __( "Region", "twentyseventeen" ),
@GarySwift
GarySwift / gist:fee4b77a05afbba620b7f5c20f61c69f
Created November 7, 2017 11:42 — forked from dwoodard/gist:4348994
Javascript: isValidDate()
function isValidDate(value, userFormat) {
// Set default format if format is not provided
userFormat = userFormat || 'mm/dd/yyyy';
// Find custom delimiter by excluding the
// month, day and year characters
var delimiter = /[^mdy]/.exec(userFormat)[0];
// Create an array with month, day and year
@GarySwift
GarySwift / isValidDate.js
Created November 7, 2017 11:42 — forked from aaugustin/isValidDate.js
isValidDate in JavaScript
export const DAYS_IN_MONTH = [null, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
function daysInMonth(year, month) {
// isValidDate checked that year and month are integers already.
// February of leap years. Assumes that the Gregorian calendar extends
// infinitely in the future and in the past.
if (month === 2 && (year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0))) {
return 29
}
@GarySwift
GarySwift / copy.js
Last active July 24, 2023 12:05
5 ways copy text to clipboard using jQuery (+ JavaScript)
jQuery(document).ready(function($) {
// If a copy clickable input is clicked
// input value will be highlighted and copied to clipboard
$('body').on('click', 'input.js-click-to-copy-input', function(e) {
copy_input( this );
});
// If a button to copy an input is clicked
// associated input value will be highlighted and copied to clipboard
$('body').on('click', 'a.js-click-to-copy-link', function(e) {
@GarySwift
GarySwift / stickyfooter.js
Created September 25, 2017 09:10
Sticky Footer #FoundationPress #JavaScript
/* Sticky Footer */
(function($) {
var $footer = $('#footer-container'); // only search once
$(window).bind('load resize orientationChange', function () {
var pos = $footer.position(),
height = ($(window).height() - pos.top) - ($footer.height() -1);
@GarySwift
GarySwift / FontAwesome.md
Last active March 29, 2020 02:08
Installing Font Awesome into FoundationPress.
@GarySwift
GarySwift / SLICK.md
Last active February 19, 2020 22:47
Quick reminder of how to install Ken Wheeler's Slick into Ole Fredrik's FoundationPress. #slick #slider
@GarySwift
GarySwift / copyright.php
Created July 21, 2017 09:30
Footer Copyright. #php #zurbfoundation
@GarySwift
GarySwift / README.md
Last active June 5, 2020 06:58
Event listener examples for dimsemenov's Magnific Popup. The library can be installed from here https://github.com/dimsemenov/Magnific-Popup. #lightbox #popup

Event listener examples for dimsemenov's Magnific Popup.

The library can be installed from here [https://github.com/dimsemenov/Magnific-Popup].

Updated FOundationPress Zurb 6.4

via Bower bower install magnific-popup --save

WordPress Notes

@GarySwift
GarySwift / _header-slide-down-sticky.scss
Created July 18, 2017 09:23
FoundationPress add for sticky header. The header scroll off the page as normal but we use the $(window).scroll event to detect if it has scrolled off page and if it has we apply the css class 'fixed' to the header. The animation and header absolute positioning is then handled with css using keyframes, positioning and breakpoints.
// Header fixed positioning and animation
header.site-header.fixed {
position: fixed;
top: 0;
left: 0;
right:0;
transition: all 0.3s;
transform: translateY(0);
opacity: 0;
$animation: move-down-fixed-header ease-in 0.3s normal forwards;