Skip to content

Instantly share code, notes, and snippets.

View tlongren's full-sized avatar
🎯
Focusing

Tyler Longren tlongren

🎯
Focusing
View GitHub Profile
@tlongren
tlongren / flash-all.sh
Last active December 15, 2020 03:25 — forked from npjohnson/flash-all.sh
#!/bin/sh
# Copyright 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#!/bin/sh
# Copyright 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@tlongren
tlongren / speedtest-simple.sh
Last active October 27, 2020 02:57
Speedtest.net logger
#!/bin/bash
OUTPUT=`speedtest-cli --simple --share`
echo -e "$OUTPUT\n$RIGHTNOW\n#############\n" >> st_results_simple
@tlongren
tlongren / checkForString.php
Created June 27, 2013 16:03
My favorite method for checking for the existence of a string in a variable
<?php
$status = (strpos($_SERVER['REQUEST_URI'],'my-page') ? 'active' : 'notactive');
?>
@tlongren
tlongren / dockerize-meteor-app.sh
Last active June 11, 2019 06:41
Dockerize a Meteor App
#!/bin/bash
# Taken from https://blog.mvp-space.com/how-to-dockerize-a-meteor-app-with-just-one-script-4bccb26f6ff0
APP_NAME=myapp
APP_DOMAIN=localhost
APP_PORT=3000
SETTINGS_PATH=.config/staging/settings.json
MONGO_URL=localhost
MONGO_PORT=27017
MONGO_DB=myappdb
@tlongren
tlongren / compression-minify-wordpress.md
Last active May 6, 2019 01:52
Output Compression, Browser Caching, Asset Minification and Image Optimization for WordPress

Output Compression, Browser Caching, Asset Minification and Image Optimization

The following apache and nginx configurations will handle compression and browser caching. A few different WordPress plugins can be used for asset minification.

mod-pagespeed may be available for configuration as an apache or nginx module. If available, there's no need to use the individual apache or nginx configurations. Mod-pagespeed will handle compression and browser caching, making the apache and nginx configurations unnecessary. The WordPress plugins are still needed for asset minification as they ensure assets are loaded in the proper order once minified.

Image optimization should be done using the EWWW Image Optimizer plugin.

Apache Config

Output Compression

@tlongren
tlongren / sendit.md
Last active April 12, 2019 16:05
How To Send a Pull Request

##How To Send a Pull Request on GitHub

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
@tlongren
tlongren / functions.php
Last active October 11, 2018 15:11
Auto Get Schema Type By Post Type
<?php
function html_tag_schema() {
$schema = 'http://schema.org/';
// Is single post
if(is_single()) {
$type = "Article";
}
// Is author page
@tlongren
tlongren / a-coming-soon-page.markdown
Created October 4, 2018 06:01
A "Coming Soon" page

A "Coming Soon" page

Place this as a temporary homepage for visitors to know that your website is under construction.

A Pen by Ompmega on CodePen.

License.

@tlongren
tlongren / functions.php
Last active September 24, 2018 13:48
Add Open Graph Markup to WordPress Theme
<?php
function add_opengraph_markup() {
if (is_single()) {
global $post;
if(get_the_post_thumbnail($post->ID, 'thumbnail')) {
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_object = get_post($thumbnail_id);
$image = $thumbnail_object->guid;
} else {
// set default image