Skip to content

Instantly share code, notes, and snippets.

View Buooy's full-sized avatar

0xBuooy Buooy

View GitHub Profile
@Buooy
Buooy / backToTop.jquery.js
Last active December 2, 2015 07:23
jQuery script to add a back to top button. Requires jQuery and Font Awesome
jQuery.fn.backtotop = function( options ) {
// This is the easiest way to have default options.
var settings = jQuery.extend({
color: "white",
backgroundColor: "rgba(200,200,200,0.75)",
visibleAfter: "100px",
left : "15px",
right: "",
marginLeft : "0px",
@Buooy
Buooy / disable-dashboard-widgets.php
Created August 5, 2015 06:36
Disable Dashboard Widgets
Disable Default Dashboard Widgets
@ https://digwp.com/2014/02/disable-default-dashboard-widgets/
*/
function disable_default_dashboard_widgets() {
global $wp_meta_boxes;
// wp..
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
@Buooy
Buooy / class-wp-footer-content.php
Created August 2, 2015 04:57
WordPress - Changes the footer content
@Buooy
Buooy / gulpfile.js
Last active August 29, 2015 14:25
Gulpfile Starter
/*
* Run This Script beforehand
* npm install --save-dev gulp gulp-clean gulp-ruby-sass gulp-concat gulp-minify-css gulp-uglify gulp-babel run-sequence
*/
var gulp = require('gulp');
var clean = require('gulp-clean');
var sass = require('gulp-ruby-sass');
var concat = require('gulp-concat');
@Buooy
Buooy / remove-breadcrumbs.php
Created December 4, 2014 08:31
Woocommerce - Remove Breadcrumbs
<?php
add_action( 'init', 'jk_remove_wc_breadcrumbs' );
function jk_remove_wc_breadcrumbs() {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}
?>
@Buooy
Buooy / generate_unique_random.js
Last active August 29, 2015 14:06
Generates a Random Set of Unique Numbers within a range
// Credits to http://stackoverflow.com/questions/2380019/generate-8-unique-random-numbers-between-1-and-100
function generate_unique_random( set_length, max_range ){
var arr = []
while(arr.length < set_length){
var randomnumber=Math.ceil( Math.random() * max_range )
var found=false;
for(var i=0;i<arr.length;i++){
if(arr[i]==randomnumber){found=true;break}
}
if(!found)arr[arr.length]=randomnumber;
@Buooy
Buooy / centerme.js
Last active August 29, 2015 14:06
Javascript to Horizontally Centers a child and outer parent
jQuery(document).ready(function($){
function centerme( parent, child ){
var child_margin_top = ( $(parent).innerHeight()-$(child).innerHeight() )/2;
if( child_margin_top < 0 ) return;
$(child).css( 'margin-top', child_margin_top+'px' );
}
});
@Buooy
Buooy / clean_up_header.php
Created September 7, 2014 13:05
WordPress Clean Up Header
// functions.php
// =========================================================================
// REMOVE JUNK FROM HEAD
// =========================================================================
remove_action('wp_head', 'rsd_link'); // remove really simple discovery link
remove_action('wp_head', 'wp_generator'); // remove wordpress version
remove_action('wp_head', 'feed_links', 2); // remove rss feed links (make sure you add them in yourself if youre using feedblitz or an rss service)
remove_action('wp_head', 'feed_links_extra', 3); // removes all extra rss feed links
@Buooy
Buooy / gist:a6b2f62de0cd509d7e99
Created July 8, 2014 09:44
ACF Date Time Picker with WP GMT offset
<?php
/*
* Functions Modifications to couple ACF Date time Picker with the GMT offset in WP
*
* To use them, just replace the functions with the ones below.
* Modifications are indicated with <=== MODIFICATION
*
*/
function update_value( $value, $post_id, $field ) {
$field = array_merge($this->defaults, $field);
@Buooy
Buooy / class-custom-pro-sites-stats.php
Last active August 29, 2015 14:03
Custom WPMU Dev Pro Site Stats
<?php
/* ================================================================================
Custom_Pro_Sites_Stats
A simple class to work with WPMU Dev's Pro Sites Plugin to get basic site details
Available Public Functions:
1. get_all_blogs_details( ) : Returns an array of details about the blog as follows:
a. ['domain'] => domain name
b. ['start'] => start date of the blog