Skip to content

Instantly share code, notes, and snippets.

@halfempty
halfempty / rubin.html
Created October 9, 2023 19:07
Rubin scripts
<!-- Global site tag (gtag.js) - Google Ads: 646509206 -->
<script async type="text/javascript" src="https://www.googletagmanager.com/gtag/js?id=AW-646509206"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-646509206');
</script>
<script>
gtag('event', 'conversion', {'send_to': 'AW-646509206/89afCKzcqc4BEJblo7QC'});
/**
* @license
* MyFonts Webfont Build ID 3578304, 2018-05-10T17:17:43-0400
*
* The fonts listed in this notice are subject to the End User License
* Agreement(s) entered into by the website owner. All other parties are
* explicitly restricted from using the Licensed Webfonts(s).
*
* You may obtain a valid license at the URLs below.
*
@halfempty
halfempty / somejs.js
Last active May 24, 2017 22:17
Notes for Will
// Checking visibility
jQuery.fn.isScrolledIntoView = function () {
var thisOffset = $(this).offset().top;
var windowHeight = $(window).height();
var heightToThis = thisOffset - windowHeight;
var scrollPosition = $(window).scrollTop();
<?php
/**
* @package Cecil
*/
namespace Carnegie_Museums\Warhol\Theme;
use Carnegie_Museums\Warhol\Theme\Helpers;
if ( is_page('calendar-2') ) :
<?php
/**
* Product Loop Start
*
* This template can be overridden by copying it to yourtheme/woocommerce/loop/loop-start.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@halfempty
halfempty / connections.php
Created September 1, 2015 00:21
Sample Posts 2 Posts + The Event Calendar connections
<?php
/*
Plugin Name: Connections
*/
function clock_p2p_register_connections() {
p2p_register_connection_type( array(
'name' => 'posts_to_tribe_events',
@halfempty
halfempty / functions.php
Created May 19, 2015 05:51
WordPress Decoy Page
<?php
function decoy_page( $query ) {
global $wp;
if ( !is_admin() && $query->is_main_query() ) {
if ( ( $query->get( 'page_id' ) == get_option( 'page_on_front' ) && get_option( 'page_on_front' ) ) || empty( $wp->query_string ) ) {
echo 'This displays when set to A Static Page and the homepage is showing.';
@halfempty
halfempty / srcset.php
Last active August 29, 2015 14:15
srcset image tag functions for WordPress
// Image Sizes
add_image_size( 'padmini', 1024 );
add_image_size( 'phone', 1136 );
add_image_size( 'phoneplus', 1334 );
add_image_size( 'padretina', 2048 );
function spellerberg_get_image($imageid,$fallbacksize = 'full') {
$sizes[] = wp_get_attachment_image_src( $imageid, 'padmini');
$sizes[] = wp_get_attachment_image_src( $imageid, 'phone');
@halfempty
halfempty / layout.js
Created February 4, 2015 17:51
Workaround to prevent under-layer scrolling on iOS
var myScrollTop = 0;
jQuery.fn.openLightbox = function() {
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
myScrollTop = $('body').scrollTop();
var wpadminbar = 0;
if ($('#wpadminbar').length != 0) {
wpadminbar = $('#wpadminbar').outerHeight();
@halfempty
halfempty / gist:6b428590eadea86c508c
Created November 7, 2014 01:34
WordPress vimeo ids to params and markup
<?php
// Curl helper function
function curl_get($url) {
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$return = curl_exec($curl);
curl_close($curl);