Skip to content

Instantly share code, notes, and snippets.

View greatislander's full-sized avatar
⛴️

Ned Zimmerman greatislander

⛴️
View GitHub Profile
@greatislander
greatislander / book-hooks.php
Created February 5, 2018 20:06
Demonstration of the new action hooks in Book 2.0.
<?php
// Append content to the end of the cover page book header block.
add_action( 'pb_book_cover_after_book_header', function() {
printf( '<p>%s</p>', 'Content goes here.' );
} );
// Append content to the end of the cover page table of contents block.
add_action( 'pb_book_cover_after_toc', function() {
printf( '<p>%s</p>', 'Content goes here.' );
<link type="text/css" rel="stylesheet" href="http://tascha.uw.edu/wp-content/themes/tascha/css/tascha-wrapper.css" />
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="http://tascha.uw.edu/wp-content/themes/tascha/js/tascha-footer.js"></script>
<script src="http://tascha.uw.edu/wp-content/themes/tascha/js/tascha-header.js"></script>
.home .book-info .book-author,
.home .book-header__author {
display: none;
}
@greatislander
greatislander / SassMeister-input.scss
Created September 22, 2017 18:03
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
$base-font-size: 12;
@function em($size, $base-font-size) {
@return ($size / $base-font-size) * 1em;
}
<?php
// Array with filter hook.
$my_array = apply_filters( 'filter_my_array', array(
'value1',
'value2',
'value3',
) );
/**
// SCSS v2 (first draft)
// Set variable
@if $type = 'epub' {
$body-font-size: medium !default;
} @elseif $type = 'prince' {
$body-font-size: 11pt !default;
} @elseif $type = 'web' {
$body-font-size: 14pt !default;
@greatislander
greatislander / check-mimetype.php
Created January 12, 2017 14:59
Check a file's mime type.
<?php
parse_str(implode('&', array_slice($argv, 1)), $_GET);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$real_mime = finfo_file($finfo, $_GET['file']);
finfo_close($finfo);
echo $real_mime . "\n";
@greatislander
greatislander / web.php
Last active January 9, 2017 16:37
Custom theme options in existing tab for Pressbooks.
<?php
add_action( 'pb_theme_options_web_add_settings_fields', 'add_custom_web_settings', 10, 2 );
add_filter( 'pb_theme_options_web_booleans', 'get_custom_booleans' );
/**
* Add the setting itself.
*
* @param string $_page The settings identifier, e.g. pressbooks_theme_options_web
* @param string $_section The settings section identifier, e.g. web_options_section
@greatislander
greatislander / word.html
Last active January 3, 2017 20:17
Word import comparison
<div class="__UNKNOWN__">
<p class="import-NormalWeb" style="background-color:#FFFFFF;text-align:justify;text-justify:inter-ideograph;"><span style="font-family:Arial;color:#000000;font-size:10.5pt;"/><span style="font-family:Arial;color:#000000;font-size:10.5pt;">Lorem ipsum </span><span style="font-family:Arial;color:#000000;font-size:10.5pt;">dolor</span><span style="font-family:Arial;color:#000000;font-size:10.5pt;"> sit</span><span style="font-family:Arial;color:#000000;font-size:10.5pt;"> </span><span style="font-family:Arial;color:#000000;font-size:10.5pt;">amet</span><span style="font-family:Arial;color:#000000;font-size:10.5pt;">, </span><span style="font-family:Arial;color:#000000;font-size:10.5pt;">consectetur</span><span style="font-family:Arial;color:#000000;font-size:10.5pt;"> </span><span style="font-family:Arial;color:#000000;font-size:10.5pt;">adipiscing</span><span style="font-family:Arial;color:#000000;font-size:10.5pt;"> </span><span style="font-family:Arial;color:#000000;font-size:10.5pt;
#wrap {
width: 940px;
}
#content {
width: 520px;
padding-right: 60px;
padding-left: 60px;
margin-right: 60px;
margin-left: 60px;