Skip to content

Instantly share code, notes, and snippets.

Danny D. dannydickson

Block or report user

Report or block dannydickson

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
View fit-to-parent.js
jQuery.fn.fitToParent = function (options) {
this.each(function () {
// Cache the resize element
var $el = jQuery(this);
// Get size parent (box to fit element in)
var $box;
if( $el.closest('.size-parent').length ) {
@dannydickson
dannydickson / customize.php
Last active Jan 13, 2017
Color Picker in Customizer (WordPress/Genesis)
View customize.php
<?php
// Set default color and store in function
function maker_customizer_get_default_primary_color() {
return '#57e5ae';
}
// Hooks into customize_register to add the custom code we'll need
add_action( 'customize_register', 'maker_customizer_register' );
@dannydickson
dannydickson / vanilla-smooth-scroll.js
Last active Jan 13, 2017
Vanilla JS Smooth Scroll
View vanilla-smooth-scroll.js
// Smooth Scroll
$(function() {
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
@dannydickson
dannydickson / add-div-to-blog-page.php
Last active Jan 13, 2017
Add custom div to blog page
View add-div-to-blog-page.php
// add custom div to blog page
function my_content($content) {
global $post;
return '<div class="blog-wrap">'.$posts.'</div>';
}
add_filter('the_content', 'my_content');
@dannydickson
dannydickson / back-to-top.js
Last active Jan 16, 2017
Floating Font Awesome Back to Top Button in WordPress
View back-to-top.js
$(".to-top-btn").click( function(){
$("html, body").animate({ scrollTop: 0 }, "slow");
});
@dannydickson
dannydickson / functions.php Add A Genesis Featured Image Above Post With Title
View functions.php
// Hook after header area
add_action( 'genesis_after_header', 'gd_featured_image_title' );
function gd_featured_image_title() {
// If it is a page and has a featured thumbnail, but is not the front page do the following...
if (has_post_thumbnail() && is_single() ) {
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
@dannydickson
dannydickson / image-overlay-angle.css
Last active Jan 26, 2017
Angled Image Overlay CSS
View image-overlay-angle.css
.class-name {
background: #ff6319;
background: -moz-linear-gradient(-45deg, #ff6319 0%, #ffa719 100%);
background: -webkit-linear-gradient(-45deg, #ff6319 0%, #ffa719 100%);
background: linear-gradient(135deg, #ff6319 0%, #ffa719 100%);
opacity: .93;
content: "";
display: block;
position: absolute;
top: 0;
@dannydickson
dannydickson / 0_reuse_code.js
Created Feb 16, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View material-button.css
.button {
box-shadow: 0 2px 2px 0 rgba(244,67,54,0.14), 0 3px 1px -2px rgba(244,67,54,0.2), 0 1px 5px 0 rgba(244,67,54,0.12);
}
.button::hover {
box-shadow: 0 14px 26px -12px rgba(244,67,54,0.42), 0 4px 23px 0px rgba(0,0,0,0.12), 0 8px 10px -5px rgba(244,67,54,0.2);
}
@dannydickson
dannydickson / functions.php
Created Jan 21, 2017
Import Font Awesome Latest Into WordPress
View functions.php
// Load Font Awesome
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css' );
}
You can’t perform that action at this time.