Skip to content

Instantly share code, notes, and snippets.

Jake Bellacera jakebellacera

Block or report user

Report or block jakebellacera

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jakebellacera
jakebellacera / pantheon-lando-without-proxy.md
Last active Jul 18, 2017
How to set up a pantheon lando application without the proxy on macOS 10.12+
View pantheon-lando-without-proxy.md

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 Aug 27, 2018
How to write multi-line lists in Markdown
View multi-line-lists-in-markdown.md

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 Oct 29, 2018
Learn how to get the ID of any YouTube video.
View how-to-get-youtube-video-id.md

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 Aug 24, 2018
How to install a basic Apache, PHP and MySQL development environment with Homebrew. Mirrored from the Echo & Co. blog.
View how-to-install-php-development-environment-on-osx.md

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 Aug 17, 2016
Basic example of SEO-friendly HTML meta tags.
View basic-meta-tags.html
<!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>
@jakebellacera
jakebellacera / force_new_tab.php
Last active Jun 3, 2016
Force PDF links to open in a new tab in PHP.
View force_new_tab.php
$new_text = preg_replace(
'/((<a (?=.*\.pdf)(?!.*target="_blank").*?)>)/',
'$2 target="_blank">',
$old_text
);
@jakebellacera
jakebellacera / multiple-gulp-streams.js
Created May 1, 2015
How to run multiple streams in a single gulp task.
View multiple-gulp-streams.js
var es = require("event-stream");
var gulp = require("gulp");
// Important! If these tasks need to be ran sequentially, then specify the
// task(s) that need to be ran prior to these ones as a dependency.
gulp.task("move-files", function() {
return es.merge([
gulp.src("foo").pipe(gulp.dest("dist/")),
gulp.src("bar").pipe(gulp.dest("dist/")),
gulp.src("baz").pipe(gulp.dest("dist/")),
@jakebellacera
jakebellacera / 2x-bg-images.less
Created Apr 6, 2015
simple 2x images in LESS
View 2x-bg-images.less
// Sets a 1x and a 2x background-image on an element.
//
// Arguments:
// @path - a String path to the 1x version of the image. The 2x version of this
// image must exist in the same directory as the 1x and have "_2x" at
// the end of its filename.
// @size - the value for the background-size attribute (e.g. 10px 20px; 100%).
.bg-image(@path, @size) {
background-image: url(@path);
background-size: @size;
View floodlight-click-handler.js
document.getElementById("button").addEventListener("click", function(e) {
e.preventDefault();
var url = this.getAttribute("href", 2);
createFloodlightTag("source", "type", "cat", function() {
window.location = url; // Redirect the user after the tag successfully fires
});
});
function createFloodlightTag(source, type, cat, callback) {
@jakebellacera
jakebellacera / search-posts-by-guest-authors.php
Last active Jul 19, 2018
Include posts from Co-Authors Plus Guest Authors in Wordpress' search results
View search-posts-by-guest-authors.php
<?php defined('ABSPATH') or die();
/**
* Include posts from guest authors in the search results.
* @author jakebellacera
*/
add_filter('posts_clauses', 'search_posts_clauses', 10, 2);
function search_posts_clauses($clauses, $query) {
if (!$query->is_main_query && !$query->is_search && !$query->is_admin)
return $clauses;
You can’t perform that action at this time.