Skip to content

Instantly share code, notes, and snippets.

Jeremy Englert JeremyEnglert

Block or report user

Report or block JeremyEnglert

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
@JeremyEnglert
JeremyEnglert / create-instance.js
Created Aug 22, 2019
Google Cloud Compute API
View create-instance.js
// Imports the Google Cloud client library
const Compute = require('@google-cloud/compute');
// Creates a client
const compute = new Compute();
async function quickstart() {
// Create a new VM using the latest OS image of your choice.
const zone = compute.zone('us-central1-c');
@JeremyEnglert
JeremyEnglert / nested-breakpoints.css
Last active Jul 18, 2019
Nesting custom CSS media queries
View nested-breakpoints.css
/* Input */
@custom-media --medium (min-width: 640px);
a {
color: red;
@media (--medium) {
color: green;
}
}
View gist:b5519e63a6cce3276208a902bb863624
<div id="off-canvas" class="off-canvas offcanvas-full-screen" data-off-canvas data-transition="overlap">
<div class="offcanvas-full-screen-inner">
<button class="offcanvas-full-screen-close" aria-label="Close menu" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<?php joints_off_canvas_nav(); ?> <!-- This is the offcanvas/mobile nav -->
<?php joints_top_nav(); ?> <!-- This is the top nav -->
@JeremyEnglert
JeremyEnglert / remove-slug.php
Created Apr 6, 2019
Remove slug from WP CPT
View remove-slug.php
<?php
function remove_diets_slug($post_link, $post, $leavename) {
if (!in_array($post->post_type, array('mat_diets')) || 'publish' != $post->post_status)
return $post_link;
$post_link = str_replace('/diets/', '/', $post_link);
return $post_link;
}
add_filter('post_type_link', 'remove_diets_slug', 10, 3);
@JeremyEnglert
JeremyEnglert / .htaccess
Last active Feb 26, 2019
Put this in your local wp-content/uploads directory to avoid needing to move media files to your local environment.
View .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) https://YOURLIVEURL.com/wp-content/uploads/$1 [L]
View Webpack.config.js
const path = require('path');
// Used to create a local server
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
// Use to minify JS
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
// Used to compile Sass into CSS
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
@JeremyEnglert
JeremyEnglert / beaver.php
Last active Oct 2, 2019
Set BeaverBuilder as Default Editor
View beaver.php
<?php
// Sets Beaver Builder as the default editor.
function make_beaver_builder_default( $post_ID, $post, $update ) {
if ( ! $update ) {
update_post_meta( $post_ID, '_fl_builder_enabled', true );
}
}
add_action( 'wp_insert_post', 'make_beaver_builder_default', 10, 3 );
@JeremyEnglert
JeremyEnglert / beaver-builder-improvements.php
Created Nov 10, 2018
Set BeaverBuilder as Default Editor
View beaver-builder-improvements.php
// Sets Beaver Builder as the default editor.
function make_beaver_builder_default( $post_ID, $post, $update ) {
if ( ! $update ) {
update_post_meta( $post_ID, '_fl_builder_enabled', true );
}
}
add_action( 'wp_insert_post', 'make_beaver_builder_default', 10, 3 );
@JeremyEnglert
JeremyEnglert / build.js
Last active Oct 13, 2018
JavaScript Async/Await with Inquirer
View build.js
async function startTheme() {
try {
const answers = await inquirer.prompt(questions);
const themeSetup = await Promise.all ([
downloadFramework(answers.framework), // This task takes some time to run
installFramework(answers.framework),
changeThemeName(answers.themeName),
changeNamespace(answers.themeNamespace),
changeLocalUrl(answers.themeLocalUrl)
])
@JeremyEnglert
JeremyEnglert / build.js
Created Oct 12, 2018
Inquirer Promise Chaining
View build.js
inquirer
.prompt([
{
type: 'list',
name: 'framework',
message: 'What framework would you like to install?',
choices: ['None', 'Foundation', 'Bootstrap'],
}
])
.then(answers => {
You can’t perform that action at this time.