Skip to content

Instantly share code, notes, and snippets.

View anthonylrivera's full-sized avatar
🤔

Anthony L Rivera anthonylrivera

🤔
View GitHub Profile
@anthonylrivera
anthonylrivera / instant-custom-fields.php
Created May 24, 2014 13:44
Instant Custom Fields WordPress Plugin
<?php
/*
Plugin Name: Instant Custom Fields
Description: Allows instant embedding of custom fields in Post & Page Content. Useful for javascript tags (Video Embeds) that get stripped from Post Content.
Plugin URI: http://anthonylrivera.net
Author: Anthony L. Rivera
Author URI: http://anthonylrivera.net
Version: 1.0
License: GPL2
@anthonylrivera
anthonylrivera / WP-DEBUG.php
Created September 22, 2014 20:22
Functions to help debug and log to wp-content/debug.log
<?php
/* wp-content/themes/[THEME]/functions.php */
if(!function_exists('_log')){
function _log( $message ) {
if( WP_DEBUG === true )
( is_array( $message ) || is_object( $message ) ) ? error_log( print_r( $message, true ) ) : error_log( $message );
}
@anthonylrivera
anthonylrivera / Facebook In-App Browser User Agent
Last active August 29, 2015 14:14
Mobile Browser User Agents
Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B466 [FBAN/FBIOS;FBAV/23.0.0.7.11;FBBV/6551639;FBDV/iPhone5,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/8.1.3;FBSS/2; FBCR/AT&T;FBID/phone;FBLC/en_US;FBOP/5]
@anthonylrivera
anthonylrivera / scroll.js
Created July 31, 2015 04:43
Optimized Scroll Detection Technique
var outerPane = $details.find(".details-pane-outer"),
didScroll = false;
$(window).scroll(function() {
didScroll = true;
});
setInterval(function() {
if ( didScroll ) {
didScroll = false;
body.open {
transition: transform 200ms ease 0s;
transform: translate(250px, 0px);
}
.site-menu__main {
left: 0;
}
body.open .site-menu__main{
@anthonylrivera
anthonylrivera / list-all-hooked-wordpress-functions.php
Created October 29, 2015 06:43
List all hooked WordPress functions
<?php
function list_hooked_functions($tag=false){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
return;
}
@anthonylrivera
anthonylrivera / body-overflow.js
Created November 15, 2017 18:01
Finding/Fixing Unintended Body Overflow
// Courtesy of CSS Tricks : https://css-tricks.com/findingfixing-unintended-body-overflow/
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
@anthonylrivera
anthonylrivera / timestamp2date-excel.txt
Created January 25, 2018 19:58
Formula to convert a UNIX timestamp (in cell C2) to Excel date format.
=(C2/86400/1000)+25569