Skip to content

Instantly share code, notes, and snippets.

View jakebellacera's full-sized avatar

Jake Bellacera jakebellacera

View GitHub Profile
/*
* HubSpot's tracking code object is inaccessible from the global context, but by
* pushing functions to the HubSpot tracking code's queue, you can access it via
* the arguments passed to the callback function.
*/
_hsq.push(function(hstc, ctx) {
console.log(hstc); // HubSpot tracking code object
console.log(ctx); // HubSpot tracking code context
@jakebellacera
jakebellacera / bootstrap-4-menu-wordpress-filters.md
Last active October 18, 2022 21:20
Bootstrap 4 menus in WordPress via filters. No walker needed!

Bootstrap 4 menus in WordPress with filters

No walker needed!

This snippet allows you to create Bootstrap 4 menus without the use of a Walker. Instead, we're using filters to leverage WordPress core functionality as much as possible. Basically, all you need to do is this and you're done:

<nav class="navbar navbar-expand-lg fixed-top">
  <div class="container">
    <a class="navbar-brand" href="<?php echo home_url(); ?>">
@jakebellacera
jakebellacera / _Integrate-Yoast-and-CoAuthors-Plus-in-WordPress.md
Last active February 2, 2018 17:28
Integrate Yoast and CoAuthors Plus in WordPress

Integrate Yoast and Co-Authors Plus

If your WordPress site utilizes both Co-Authors Plus and Yoast, you may be aware that the two plugins don't fully integrate with eachother. The PHP code below fixes the following issues:

  • When viewing a Co-Author's page, Yoast's author name (%%name%%) meta tag template variables will properly show the Co-Author's name.
  • When viewing a Co-Author's page, Yoast's breadcrumb trail will properly show the Co-Author's name.

How to install

Simply drop the code below into your theme's functions.php file.

@jakebellacera
jakebellacera / robots.txt
Created September 14, 2017 23:18
Robots.txt file instructing crawlers to not crawl any pages on the hostname
User-agent: *
Disallow: /
@jakebellacera
jakebellacera / .htaccess-wordpress
Created August 7, 2017 15:10
Default htaccess configuration for a WordPress site
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@jakebellacera
jakebellacera / pantheon-lando-without-proxy.md
Last active July 18, 2017 01:21
How to set up a pantheon lando application without the proxy on macOS 10.12+

How to set up a pantheon lando application without a proxy on macOS 10.12+

This guide explains how to use a pantheon lando application without the proxy server on your local machine. Instead of using a proxy server, you will use dnsmasq and pfctl to port forward your lando application's webserver ports to 80 and 443.

Note: you will have to perform some manual interactions for each lando application you create. See the instructions below.

  1. First, install homebrew

  2. Then, install and setup dnsmasq with homebrew:

@jakebellacera
jakebellacera / multi-line-lists-in-markdown.md
Last active April 25, 2022 15:58
How to write multi-line lists in Markdown

Perhaps you're writing an ordered list in markdown and you need to add a list item or two with multiple lines. You try to write it, but your numbers keep resetting! What gives?

What you need to do is add a space after each additional line in a list item.

Quick example

1. Item number one

 Second line in item number one.
@jakebellacera
jakebellacera / how-to-get-youtube-video-id.md
Last active February 25, 2024 11:24
Learn how to get the ID of any YouTube video.

How to get the ID of any YouTube Video

This article walks you through how to get the ID of any YouTube video.

How to get a YouTube video ID from a youtube.com page URL

You may be watching the video or just happened to visit a link to a video. The video ID will be located in the URL of the video page, right after the v= URL parameter.

@jakebellacera
jakebellacera / how-to-install-php-development-environment-on-osx.md
Last active August 24, 2018 10:53
How to install a basic Apache, PHP and MySQL development environment with Homebrew. Mirrored from the Echo & Co. blog.

How to install a basic Apache, PHP and MySQL development environment with Homebrew

This guide will walk you through the steps required to install a basic Apache, PHP and MySQL development environment using homebrew. Basically, all you'll need to do is copy the commands below into Terminal. Copy one block at a time.

NOTE: this guide is mirrored from Echo & Co.'s blog in case the original blog post or the website decides to go down. I've shared this guide around many times to colleagues and friends. Please give Alan Ivey (@alanthing) all of the credit for publishing this really helpful guide.

Before we begin...

We're going to need to install homebrew, a super awesome package manager for OS X. Installation instructions are available on the homebrew website.

@jakebellacera
jakebellacera / basic-meta-tags.html
Created August 17, 2016 20:29
Basic example of SEO-friendly HTML meta tags.
<!DOCTYPE html>
<html>
<head>
<title>My Page's Title - Site Name</title>
<meta name="description" content="My page's description. This should be no more than 155 characters or else it may be truncated.">
<meta name="og:title" content="My Page's title">
<meta name="og:description" content="My page's description. This should be no more than 155 characters or else it may be truncated.">
<meta name="og:image" content="http://mywebsite.com/default-og-thumbnail.png">
</head>
<body>