Skip to content

Instantly share code, notes, and snippets.

View jdsteinbach's full-sized avatar
💭
💻

James Steinbach jdsteinbach

💭
💻
View GitHub Profile
@jdsteinbach
jdsteinbach / ModularPHP.md
Last active June 17, 2024 20:14
Including PHP partials

We're already great with breaking giant template files into multiple smaller files in an /includes/ or /partials/ directory. I'd to talk about how we call those files in our bigger templates. The three options are include, require, and get_template_part(). The first 2 are normal PHP functions, the 3rd is a WP function. (I'm only going to really compare include and get_template_part() though: require is basically include + fatal error, so no real reason to use that by default in our own themes.)

PHP include 'file-path/file-name.php PHP docs

The include function is our default right now. It's got a couple pros over the other options: unlike require, it only generates a warning if the file isn't found, not a fatal error. Unlike get_template_part(), it respects the current file's variables.

WP get_template_part() WP Codex

This is the preferred "WP Way" to ge

@jdsteinbach
jdsteinbach / SassMeister-input-HTML.haml
Last active June 3, 2023 13:01
Generated by SassMeister.com.
.box-1
.box-2
.box-3
.box-4
@jdsteinbach
jdsteinbach / SassMeister-input.scss
Created May 13, 2014 13:30
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
$red: #ff4242;
// Declare this variable early
$parent-classes: ();
@jdsteinbach
jdsteinbach / itermProfile.json
Last active August 31, 2021 20:17
My .oh-my-zsh theme
{
"Ansi 6 Color" : {
"Red Component" : 0.30980393290519714,
"Color Space" : "Calibrated",
"Blue Component" : 0.9686274528503418,
"Alpha Component" : 1,
"Green Component" : 0.76470589637756348
},
"Ansi 12 Color" : {
"Red Component" : 0.26666668057441711,
@jdsteinbach
jdsteinbach / SassMeister-input-HTML.html
Last active June 20, 2021 15:42
Generated by SassMeister.com.
<div class="box">I'm in a box.</div>
@jdsteinbach
jdsteinbach / Subsetting.md
Created May 8, 2020 19:32
Case Studies in Font Subsetting

Case Studies in Font Subsetting

Initial Files Provided

iA Writer provided variable fonts as 2 ttfs (Upright and Italic), each ~150kb.

Note: iA Writer provided static fonts as woff2 (Regular, Italic, Bold, Bold Italic) around 45kb each. Unfortunately this can skew people's initial performance reaction away from variable fonts.

@jdsteinbach
jdsteinbach / machine.js
Last active May 1, 2020 17:05
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jdsteinbach
jdsteinbach / .htaccess
Last active November 7, 2019 03:45
Decent htaccess (WP)
# BEGIN WordPress Security + Performance
# ############################################################
# # SECURITY #
# ############################################################
# ----------------------------------------------------------------------
# | File access |
# ----------------------------------------------------------------------
# Block access to directories without a default document.
@jdsteinbach
jdsteinbach / .gitignore
Last active May 20, 2019 13:52
Sass+PostCSS
node_modules
@jdsteinbach
jdsteinbach / SimplifiedTwitter.css
Last active September 24, 2018 18:34
Simplified Twitter Styles
.ProfileSidebar,
.timeline-tweet-box,
.topbar h1,
#global-actions .text,
.moments.js-moments-tab,
.dashboard.dashboard-right,
.dashboard.dashboard-left {
display: none !important;
}
.content-main {