Skip to content

Instantly share code, notes, and snippets.

View rodruiz's full-sized avatar

Rodolfo Ruiz rodruiz

View GitHub Profile
@rodruiz
rodruiz / 01-common-example.php
Last active August 3, 2018 21:42 — forked from westonruter/01-common-example.php
Temporarily disabling filters in WordPress
<?php // Common way to do it:
remove_filter( 'the_title', 'wptexturize' );
$title = get_the_title();
add_filter( 'the_title', 'wptexturize' );
@rodruiz
rodruiz / in_viewport.js
Created January 5, 2018 00:03 — forked from jjmu15/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);