Skip to content

Instantly share code, notes, and snippets.

View mattsandersuk's full-sized avatar
🐝

Matt Sanders mattsandersuk

🐝
  • UK
View GitHub Profile
@maddisondesigns
maddisondesigns / functions.php
Last active February 7, 2024 13:42
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
@kauhat
kauhat / example.blade.php
Last active May 10, 2017 20:41
Laravel 5.4+ Bootstrap 3 panel component
@component('panel')
@slot('title')
Example
@endslot
{{-- Buttons and input inside 'panel-heading' --}}
@slot('actions')
<a class="btn btn-default" href="#">Create</a>
@endslot
@crot4lus
crot4lus / UK Bank Holidays.csv
Created November 14, 2016 08:40
CSV with MySQL friendly UK bank holidays
Name Bank Holiday Date
New Year's Day 1 2009-01-01
Robert Burns Night (Burns Night) 0 2009-01-25
Holocaust Memorial Day 0 2009-01-27
Valentines Day 0 2009-02-14
Shrove Tuesday (Pancake Day) 0 2009-02-24
Ash Wednesday 0 2009-02-25
St David's Day 0 2009-03-01
St Patricks Day 0 2009-03-17
Mothering Sunday (Mothers Day) 0 2009-03-22
@jeremyzilar
jeremyzilar / trello.md
Last active June 22, 2024 13:14
Copy Trello Board as text or markdown

Copy Trello Board as text or markdown

Wouldn't it be nice to copy out your Trello board as plain text or markdown to be able to put it in a weekly memo, shipping notice or release notes? Now you can!

How to use this

Copy this line of JS and paste it into the CONSOLE in your browser. The results will be saved to your clipboard.

Option 1: Copy your Trello Board as Markdown

This will copy your columns + cards as markdown right to left

var s = []; s.push("# " + jQuery(".board-header").children()[0].innerText); jQuery.fn.reverse = [].reverse; jQuery(".list:has(.list-header-name)").reverse().each(function() {s.push("\n## " + jQuery(this).find(".list-header-name-assist")[0].innerText + "\n"); jQuery(this).find(".list-card-title").each(function() {s.push("* " + this.innerText); }); }); copy(s.join("\n"));
@mattclements
mattclements / function.php
Last active July 2, 2024 15:32
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@kauhat
kauhat / .bashrc
Last active January 11, 2020 20:26
WP-CLI setup on Tsohost and Heart Internet shared servers
# Add ~/bin directory to path if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$PATH:$HOME/bin"
fi
# Set up alias for WP CLI
alias wp="php-7.2 $HOME/bin/wp-cli.phar"
@bassplayer7
bassplayer7 / .gitignore
Created January 6, 2014 22:17
The ultimate Wordpress .gitignore template (with some Mac OSX lines)
# You can use this template file to ignore core Wordpress files so that conflicts don't arise as a result
# of upgrading Wordpress to a newer version.
# Note: the ! excludes files from being ignored. In other words the ! INCLUDES those files in the repository.
# Make sure we don't have any unneeded files in our git repo.
/*.php
/*.sh
/*.html
/*.txt
/wp-config.php
@ozh
ozh / gist:8169202
Created December 29, 2013 10:40
Human readable time difference between 2 dates in PHP
<?php
/**
* Get human readable time difference between 2 dates
*
* Return difference between 2 dates in year, month, hour, minute or second
* The $precision caps the number of time units used: for instance if
* $time1 - $time2 = 3 days, 4 hours, 12 minutes, 5 seconds
* - with precision = 1 : 3 days
* - with precision = 2 : 3 days, 4 hours