Skip to content

Instantly share code, notes, and snippets.

View Eroan's full-sized avatar

Eroan Boyer Eroan

View GitHub Profile
@stephanschubert
stephanschubert / optimized_google_plusone.js
Created June 7, 2011 17:48
Optimized Google PlusOne Javascript - Asynchronous/Non-Blocking, Minimal + SSL Fix
<!-- Place this tag just before your close body tag and NOT in your <head> -->
<script>
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.async = true;
g.src = 'https://apis.google.com/js/plusone.js';
s.parentNode.insertBefore(g, s);
})(document, 'script');
</script>
@ericjuden
ericjuden / wordpress-options-json.php
Last active June 30, 2022 12:33
WordPress Options Class with Support for storing and retrieving JSON
<?php
class My_Plugin_Options {
var $options;
var $option_name;
var $is_site_option; // Are we using Multisite and saving to global options?
function My_Plugin_Options($option_name, $is_site_options = false){
$this->option_name = $option_name;
$this->is_site_option = $is_site_options;
if($this->is_site_option){
@deanhume
deanhume / intersection-observer.js
Last active May 20, 2021 17:55
Intersection Observer - Image lazy load
// Get all of the images that are marked up to lazy load
const images = document.querySelectorAll('.js-lazy-image');
const config = {
// If the image gets within 50px in the Y axis, start the download.
rootMargin: '50px 0px',
threshold: 0.01
};
// The observer for the images on the page
let observer = new IntersectionObserver(onIntersection, config);