Skip to content

Instantly share code, notes, and snippets.

View daltonrooney's full-sized avatar

Dalton Rooney daltonrooney

View GitHub Profile
@daltonrooney
daltonrooney / functions.php
Last active April 7, 2016 22:15
Simplify WordPress TinyMCE
<?php
/* Simplify the default tiny MCE */
add_filter( 'mce_buttons', 'wpcustom_mce_buttons_1' );
function wpcustom_mce_buttons_1( $buttons ) {
$buttons = array( 'styleselect','bold', 'italic', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'link', 'unlink', 'pastetext', 'removeformat', 'undo', 'redo');
return $buttons;
}
add_filter( 'mce_buttons_2', 'wpcustom_mce_buttons_2' );
function wpcustom_mce_buttons_2( $buttons ) {
@daltonrooney
daltonrooney / gist:a68fd2d49f2e65cde83297b2484f6564
Created January 5, 2017 18:58 — forked from jchristopher/gist:9939849
SearchWP's list of common words (stopwords)
<?php
array( "a", "able", "above", "across", "after", "afterwards", "again", "against", "ago", "all",
"almost", "alone", "along", "already", "also", "although", "always", "am", "among", "amongst", "amoungst",
"amount", "an", "and", "another", "any", "anyhow", "anyone", "anything", "anyway", "anywhere", "are", "aren't",
"around", "as", "at", "back", "be", "became", "because", "become", "becomes", "becoming", "been", "before",
"beforehand", "behind", "being", "below", "beside", "besides", "between", "beyond", "both", "bottom", "but",
"by", "call", "can", "can't", "cannot", "cant", "co", "con", "could", "couldn't", "couldnt", "de", "did", "do",
"does", "don't", "done", "dont", "down", "due", "during", "each", "eg", "eight", "either", "eleven", "else",
"elsewhere", "empty", "enough", "etc", "etc.", "even", "ever", "every", "everyone", "everything", "everywhere",
@daltonrooney
daltonrooney / twig_file_date_extension.php
Created February 8, 2017 19:36 — forked from Stoffo/twig_file_date_extension.php
Twig Function to get the file mtime in template for HTTP Caching
<?php
$function_filedate = new Twig_SimpleFunction(
'fileDate',
/**
* @param $file_path
* This function generates a new file path with the last date of filechange
* to support better better client caching via Expires header:
* i.e:
@daltonrooney
daltonrooney / acf-migrate-db-pro.php
Last active October 27, 2020 04:34
Prevent ACF Pro license key from being overwritten during WP Migrate DB Pro migration
<?php
/*
Based on http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
*/
class ACF_WP_Migrate_DB_Pro_Tweaks {
function __construct() {
add_filter( 'wpmdb_preserved_options', array( $this, 'preserved_options' ) );
}
@daltonrooney
daltonrooney / typekit.editor.php
Created April 17, 2017 22:47 — forked from mikemanger/typekit.editor.php
Add a TypeKit font to the TinyMCE editor in WordPress.
add_filter( 'mce_external_plugins', 'my_theme_mce_external_plugins' );
function my_theme_mce_external_plugins( $plugin_array ) {
$plugin_array['typekit'] = get_template_directory_uri() . '/typekit.tinymce.js';
return $plugin_array;
}
@daltonrooney
daltonrooney / .htaccess
Created September 6, 2018 18:34 — forked from zulfajuniadi/.htaccess
Enable CORS via htaccess.
Header add Content-Type "application/json"
Header add Access-Control-Allow-Methods "GET,HEAD,POST,PUT,DELETE,OPTIONS"
Header add Access-Control-Allow-Headers "Auth-Token,Content-Type"
Header add Access-Control-Allow-Origin "*"
@daltonrooney
daltonrooney / change-class-on-scroll.html
Last active May 17, 2020 16:33 — forked from ohiosveryown/change-class-on-scroll.html
Vanilla JS – change/add class based on scroll position.
// https://codepen.io/cmykw/pen/gemxJm
// layout
<nav/>
// style
<style>
body { min-height: 200vh; }
nav {
@daltonrooney
daltonrooney / calendar.js
Created September 6, 2019 05:50
Output calendar links from event in Vue.js
var MS_IN_MINUTES = 60 * 1000;
var formatTime = function (date) {
date = new Date(date * 1000);
return date.toISOString().replace(/-|:|\.\d\d\d/g, "")
};
var calendarGenerators = {
google: function (event) {
var startTime = formatTime(event.start);
@daltonrooney
daltonrooney / form.js
Last active September 24, 2019 19:03
Craft CMS + Mailchimp signup form in Vue.js
import Vue from 'vue'
import axios from 'axios'
const apiClient = axios.create({
baseURL: '',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
}
})
@daltonrooney
daltonrooney / timezoneField.json
Created October 28, 2019 22:16
Craft CMS Field Manager Time Zone import
[
{
"name":"Time Zone",
"handle":"timeZone",
"instructions":"",
"required":null,
"translationMethod":"none",
"translationKeyFormat":null,
"type":"craft\\fields\\Dropdown",
"settings":{