Skip to content

Instantly share code, notes, and snippets.

View greatislander's full-sized avatar
🪿

Ned Zimmerman greatislander

🪿
View GitHub Profile
wp core download
wp core config --dbname="dbname" --dbuser="dbuser" --dbpass="dbpass" --extra-php <<PHP
/* Pressbooks */
define( 'WP_DEFAULT_THEME', 'pressbooks-book' );
define( 'PB_PRINCE_COMMAND', '/usr/bin/prince' );
define( 'PB_KINDLEGEN_COMMAND', '/opt/kindlegen/kindlegen' );
define( 'PB_EPUBCHECK_COMMAND', '/usr/bin/java -jar /opt/epubcheck-3.0.1/epubcheck-3.0.1.jar' );
define( 'PB_XMLLINT_COMMAND', '/usr/bin/xmllint' );
PHP
wp core install --url="http://domain.com" --title="Pressbooks" --admin_user="username" --admin_password="password" --admin_email="[email protected]"
@greatislander
greatislander / hypothesis-test.php
Created October 29, 2016 17:45
Test for Hypothesis custom post type support.
<?php
function hypothesis_test_init() {
register_post_type( 'hypothesis-test', array(
'labels' => array(
'name' => __( 'Hypothesis Tests', 'hypothesis-test' ),
'singular_name' => __( 'Hypothesis Test', 'hypothesis-test' ),
'all_items' => __( 'All Hypothesis Tests', 'hypothesis-test' ),
'new_item' => __( 'New Hypothesis Test', 'hypothesis-test' ),
'add_new' => __( 'Add New', 'hypothesis-test' ),
#wrap {
width: 940px;
}
#content {
width: 520px;
padding-right: 60px;
padding-left: 60px;
margin-right: 60px;
margin-left: 60px;
@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;
@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 / 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";
// 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;
<?php
// Array with filter hook.
$my_array = apply_filters( 'filter_my_array', array(
'value1',
'value2',
'value3',
) );
/**
@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;
}
.home .book-info .book-author,
.home .book-header__author {
display: none;
}