Skip to content

Instantly share code, notes, and snippets.

View JeremyEnglert's full-sized avatar

Jeremy Englert JeremyEnglert

View GitHub Profile
var admin = require("firebase-admin");
const firebase = require("firebase");
var serviceAccount = require("./showzone-firebase-service-account.json");
// Initialize Firebase connection
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://showzone-cloud.firebaseio.com",
});
import scrapy
from scrapy.http import FormRequest
from datetime import datetime
class TSNSpider(scrapy.Spider):
startTime = datetime.now()
name = 'tsnspider'
custom_settings = {
'CONCURRENT_REQUESTS': 100,
'CONCURRENT_REQUESTS_PER_DOMAIN': 100,
@JeremyEnglert
JeremyEnglert / build.js
Last active April 22, 2020 02:58
JavaScript Async/Await with Inquirer
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 / beaver.php
Last active October 2, 2019 11:22
Set BeaverBuilder as Default Editor
<?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 / create-instance.js
Created August 22, 2019 17:59
Google Cloud Compute API
// 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 / style.scss
Created February 9, 2016 18:02
Add Foundation Icons to JointsWP
/******************************************************************
Stylesheet: Main Stylesheet
Here's where the magic happens. Here is where you import
all of your Sass files so they can compile into one
CSS file.
******************************************************************/
@JeremyEnglert
JeremyEnglert / nested-breakpoints.css
Last active July 18, 2019 08:57
Nesting custom CSS media queries
/* Input */
@custom-media --medium (min-width: 640px);
a {
color: red;
@media (--medium) {
color: green;
}
}
<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 April 6, 2019 18:18
Remove slug from WP CPT
<?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 February 26, 2019 05:39
Put this in your local wp-content/uploads directory to avoid needing to move media files to your local environment.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) https://YOURLIVEURL.com/wp-content/uploads/$1 [L]