Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@NickDeckerDevs
NickDeckerDevs / .htaccess
Created February 1, 2018 00:29
Performance Increases for htaccess / mainly wordpress sites
## BEGIN GZIP Compression ##
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
@NickDeckerDevs
NickDeckerDevs / pagination.js
Created March 2, 2018 17:44
lotsa pagination problems
// create pagintaion
function display_pagination(total) {
var pages = total / 8;
var pagination_top = pages - 4;
var dots = false;
var pagination_html = '<nav aria-label="Blog Listing Navigation" class="col-md-10 col-md-offset-1"><ul class="pagination">';
pagination_html += '<li id="pagination-back" class="pagination-link arrow page-item" data-start="BACK" data-end="BACK"><span aria-label="Previous" class="arrow-nobg page-link"><span aria-hidden="true">&laquo;</span><span class="sr-only">Previous</span></span></li>';
var pagination_start = 0;
var pagination_end = total < 8 ? total % 8 : 7;
for(var i = 0; i < pages; i++) {
@NickDeckerDevs
NickDeckerDevs / .htaccess
Created March 7, 2018 15:49
Force HTTPS on .htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
<!-- head includes begin --->
<link rel="apple-touch-icon" sizes="180x180" href="/wp-content/uploads/fbrfg/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/wp-content/uploads/fbrfg/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/wp-content/uploads/fbrfg/favicon-16x16.png">
<link rel="shortcut icon" href="/wp-content/uploads/fbrfg/favicon.ico">
<!-- head includes end --->
<?php
/* Blog post page */
get_header();
$show_default_title = get_post_meta( get_the_ID(), '_et_pb_show_title', true );
$is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() );
?>
@NickDeckerDevs
NickDeckerDevs / es6_fetch_hs_sitemap_for_string.js
Last active March 20, 2018 19:41
Loop through Sitemap.xml file and query pages in XML file for a string. Useful for finding links or other content. To use, paste the script in the console on the sitemap.xml page. Update the variable stringToCheckFor to the text you are looking for
const urlNodes = document.querySelectorAll('.text'); // use '.line .text' if you want to only search site pages, not blog also
for (let k = 0; k < urlNodes.length; k++) {
const nodeObject = urlNodes[k];
const text = nodeObject.innerText;
const url = text.toString();
if (url.includes('http')) {
// console.log('fetching from ' + url)
fetch(url)
.then(response => {
if (response.ok) {
@NickDeckerDevs
NickDeckerDevs / functions.php
Created March 22, 2018 11:37
some tierpoint stuff
<?php
function my_theme_enqueue_styles() {
$parent_style = 'parent_style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
@NickDeckerDevs
NickDeckerDevs / add_multiple_users_to_hubspot.js
Last active March 24, 2018 07:37
Attempting to programaticaly add users to hubspot settings > users & teams
var userEmails = [
// 'nickdeckerdevs@gmail.com'
// ,
'6studiozero@gmail.com'
];
function allThePromises(email) {
return Promise.resolve()
.then(function(result) {
@NickDeckerDevs
NickDeckerDevs / .gitignore
Last active March 28, 2018 11:09
Wordpress .gitignore in root folder
# Patterns in .gitignore file apply recursively to the (sub)directory the file is in
# and all its subdirectories, unless pattern contains '/'.
# Example: license.txt applies to any file named license.txt in given (root) directory and all its subdirectories,
# while /license.txt applies to file with named license.txt in given (root) directory).
# Example 2: node_modules will ignore all folders called node_modules. /node_modules will ignore only
# the node_modules folder in the root directory
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
@NickDeckerDevs
NickDeckerDevs / .htaccess
Last active April 17, 2018 16:00
.htaccess to load files from production server -- place file in /wp-content/uploads/
# Attempt to load files from production if they're
# not in our dev/local version.
# replace domain with website name on line 10
# Attempt to load files from production if they're not in our local version. Put this file in "wp-content/uploads" folder.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f