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 / 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 / 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]
@JeremyEnglert
JeremyEnglert / Webpack.config.js
Created November 20, 2018 19:16
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 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 / beaver-builder-improvements.php
Created November 10, 2018 07:41
Set BeaverBuilder as Default Editor
// 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 );