Skip to content

Instantly share code, notes, and snippets.

Dalton Rooney daltonrooney

Block or report user

Report or block daltonrooney

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@daltonrooney
daltonrooney / change-class-on-scroll.html
Last active Dec 6, 2018 — forked from ohiosveryown/change-class-on-scroll.html
Vanilla JS – change/add class based on scroll position.
View change-class-on-scroll.html
// https://codepen.io/cmykw/pen/gemxJm
// layout
<nav/>
// style
<style>
body { min-height: 200vh; }
nav {
@daltonrooney
daltonrooney / .htaccess
Created Sep 6, 2018 — forked from zulfajuniadi/.htaccess
Enable CORS via htaccess.
View .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 / export.php
Last active Apr 2, 2018
Export a WordPress post in Sprout Import format (Craft CMS 3)
View export.php
$posts = get_posts( array(
'posts_per_page' => -1,
) );
$data = array();
foreach ( $posts as $post ) :
$categories = get_the_terms($post, 'category');
if ( $categories ) :
View btc.html
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<style>
body {padding:0; margin:0}
.container {display:flex; flex-wrap: wrap;}
.child {flex-grow: 1; width:50%; height:33.3vh;}
</style>
<div class='container'>
<div class='child'>
<script type="text/javascript">
new TradingView.widget({
@daltonrooney
daltonrooney / acf.php
Created Jul 27, 2017
Save ACF datepicker field data as timestamp
View acf.php
<?php
/**
* Convert values of ACF core date time pickers from Y-m-d H:i:s to timestamp
* @param string $value unmodified value
* @param int $post_id post ID
* @param object $field field object
* @return string modified value
*/
function acf_save_as_timestamp( $value, $post_id, $field ) {
@daltonrooney
daltonrooney / .block
Last active Jul 20, 2017 — forked from sgruhier/.block
zoom/pan d3v4
View .block
license: mit
@daltonrooney
daltonrooney / typekit.editor.php
Created Apr 17, 2017 — forked from mikemanger/typekit.editor.php
Add a TypeKit font to the TinyMCE editor in WordPress.
View typekit.editor.php
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 / acf-migrate-db-pro.php
Last active Jan 6, 2019
Prevent ACF Pro license key from being overwritten during WP Migrate DB Pro migration
View acf-migrate-db-pro.php
<?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 / twig_file_date_extension.php
Created Feb 8, 2017 — forked from Stoffo/twig_file_date_extension.php
Twig Function to get the file mtime in template for HTTP Caching
View twig_file_date_extension.php
<?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 / gist:a68fd2d49f2e65cde83297b2484f6564
Created Jan 5, 2017 — forked from jchristopher/gist:9939849
SearchWP's list of common words (stopwords)
View gist:a68fd2d49f2e65cde83297b2484f6564
<?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",
You can’t perform that action at this time.