Skip to content

Instantly share code, notes, and snippets.

View jeremyHixon's full-sized avatar
😎
Killin' it

Jeremy jeremyHixon

😎
Killin' it
View GitHub Profile
@jeremyHixon
jeremyHixon / bootstrap-gutenberg-alignment.scss
Created August 6, 2019 20:40
This is the SCSS I used to make the .alignfull and .alignwide play nicely with Bootstrap
// Same styles for small devices
.alignfull, .alignwide {
margin: 0 calc( 50% - 50vw ) $alignment-margin;
max-width: 100vw;
width: 100vw;
}
// At "medium" breakpoint it moves to fill in half the viewport's whitespace
@media ( min-width: map-get( $grid-breakpoints, md ) ) {
.alignwide {
margin: 0 calc( ( ( ( 100vw - 100% ) / 2 ) / 2 ) * -1 ) $alignment-margin;
@jeremyHixon
jeremyHixon / add-editor-style-gutenberg.php
Last active December 19, 2018 13:30
WordPress 5.0's Gutenberg editor requires enqueuing of the stylesheet as well as adding support for said editor styles before it will work properly.
/**
* Add this into your functions.php file.
*/
/**
* Adding theme support
*/
if ( !function_exists( 'rwp_after_setup_theme' ) ) {
function rwp_after_setup_theme() {
add_theme_support( 'editor-styles' );
@jeremyHixon
jeremyHixon / golden-ratio-typography.sass
Created July 28, 2018 14:51
Sass functions to calculate the line height based off the font size, the content's width in px, and the golden ratio
/**
* Calculates the line height based on font size and the content's width in px. Based
* off the research underlying Pearsonified's Golden Ratio Typography Calculator
* https://pearsonified.com/typography/
* Ex: $font-size: 16px;
* $content-width: 1336px;
* $line-height: calculate-line-height( $font-size, $content-width );
*
* @since 1.0.0
@jeremyHixon
jeremyHixon / viewport-measurement.js
Created March 16, 2018 12:29
Accurate viewport measurements
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x, y;
x = w.innerWidth || e.clientWidth || g.clientWidth;
y = w.innerHeight || e.clientHeight || g.clientHeight;
@jeremyHixon
jeremyHixon / bootstrap-sample-elements-3.3.7.html
Created February 2, 2018 20:12
A compilation of Bootstrap elements to help with theming and styling. Contains the sample content and visual elements in the CSS, components and JavaScript sections of the Bootstrap website. Using Bootstrap version 3.3.7.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Sample Elements for Theming</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<style>
body {
padding-bottom: 5em;
/**
* Calculates numbers to the mathmatical power (exponent)
*
* @since 1.0.0
*
* @param int $number The number to increase
* @param int $exponent The power to increase the number by
*
* @return int The new number
*/
@jeremyHixon
jeremyHixon / repeating-wordpress-editor-plus.php
Created November 16, 2015 15:15
Repeating WordPress editor with additional field
<?php
function repeatable_editor_get_meta( $value ) {
global $post;
$field = get_post_meta( $post->ID, $value, true );
if ( ! empty( $field ) ) {
return is_array( $field ) ? stripslashes_deep( $field ) : stripslashes( wp_kses_decode_entities( $field ) );
} else {
return false;
}
/**
* Create HTML list of pages.
*
* @since 1.0
* @uses Walker_Page
*/
class Rational_Walker_Page extends Walker_Page {
/**
* @see Walker_Page::start_lvl()
* @since 1.0
@jeremyHixon
jeremyHixon / rational-option-page-class-example
Created March 27, 2015 03:13
Example of my Rational WordPress option page class
<?php
if ( is_admin() ) {
include 'rational-option-page/class.rational-option-page.php';
$my_options_page = new RationalOptionPages();
$pages = array(
// page
array(
'page_title' => 'My Options',
'menu_title' => 'My Options',
set db_user to "user"
set db_pass to "password"
set db_path to "/usr/local/mysql/bin/mysql"
set local_url to "http://localhost/"
set wp_url to "https://wordpress.org/"
set latest_wp to "latest.tar.gz"
set posix_path to POSIX path of (path to sites folder from user domain) as text
display dialog "New site folder name (e.g. custom-name):" default answer "wordpress" buttons {"Install", "Cancel"} default button 1