Skip to content

Instantly share code, notes, and snippets.

Arthur Attwell arthurattwell

Block or report user

Report or block arthurattwell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arthurattwell
arthurattwell / com.apple.ibooks.display-options.xml
Created May 12, 2016
Apple iBooks display options file for META-INF folder in .epub – basic settings
View com.apple.ibooks.display-options.xml
<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
<option name="interactive">false</option>
<option name="fixed-layout">false</option>
<option name="open-to-spread">false</option>
<option name="orientation-lock">none</option>
</platform>
</display_options>
@arthurattwell
arthurattwell / dialog.html
Last active Dec 9, 2019
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
View dialog.html
<div style="font-family: sans-serif;">
<? var data = valid(); ?>
<form id="form" name="form">
<? if(Object.prototype.toString.call(data) === '[object Array]') { ?>
<? for (var i = 0; i < data.length; i++) { ?>
<? for (var j = 0; j < data[i].length; j++) { ?>
<input type="checkbox" id="ch<?= '' + i + j ?>" name="ch<?= '' + i + j ?>" value="<?= data[i][j] ?>"><?= data[i][j] ?><br>
<? } ?>
<? } ?>
<? } else { ?>
@arthurattwell
arthurattwell / also-save-idml.js
Last active Jan 24, 2019
InDesign Startup Script that saves an IDML copy alongside INDD automatically
View also-save-idml.js
// This InDesign Startup Script saves an IDML copy of the INDD file you're saving.
// Save it in your Startup Scripts folder. For how to do that, open the tutorial
// for your version of InDesign here: https://www.adobe.com/devnet/indesign/documentation.html
// and look for the section titled 'Installing scripts'.
// Thanks to fabiantheblind here http://graphicdesign.stackexchange.com/a/71736/67488
// for the original script, which I've adapted to work as a startup script.
// Set a targetengine to make this work
#targetengine "session"
@arthurattwell
arthurattwell / start-attribute-workaround.scss
Last active Jul 11, 2016
Workaround in Sass for EPUB2's XHTML not supporting `start` attribute
View start-attribute-workaround.scss
// Workaround for EPUB2's XHTML not supporting `start` attribute
// In HTML, regex search-replace
// <ol (.*?)start="(\d+)"
// with
// <ol \1class="start-\2"
// Create 20 options for starting numbering
@for $i from 2 through 20 {
$start: $i + 1;
// If we the list ol to start at 1, the first li will be 2
@arthurattwell
arthurattwell / pandoc-docx-md.bat
Last active Jan 23, 2019
Script to convert docx to markdown with Pandoc
View pandoc-docx-md.bat
:: pandoc-docx-md.bat
::
:: Don't show these commands to the user
@ECHO off
:: Set the title of the window
TITLE Convert docx to markdown with Pandoc
:: Select file marker
:selectfile
:: Clear any preexisting filename variables
SET filename=
@arthurattwell
arthurattwell / regular-myrepos-update.sh
Last active Sep 14, 2016
Script to run regular updates to Git repos
View regular-myrepos-update.sh
#! /bin/bash
#
# ###############################################
# This script updates all my repos regularly.
# It's easier than using cron, where environments
# and permissions are a headache.
# ###############################################
#
# Ask how many seconds to leave between each update.
echo "How many seconds between each update?"
@arthurattwell
arthurattwell / princexml-reset.css
Last active Nov 21, 2019
Reset CSS for PrinceXML
View princexml-reset.css
/* Reset PrinceXML CSS (XHTML stylesheet) */
h1, h2, h3, h4, h5, h6 {
font-weight: inherit;
font-size: inherit;
}
address {
font-style: inherit;
}
@arthurattwell
arthurattwell / underline-control.scss
Created Oct 13, 2016
Sass mixin to control text underline (designed for use with PrinceXML)
View underline-control.scss
@mixin underlined($thickness,$start-position,$end-position,$vertical-position) {
display: inline-block;
position: relative;
&:after {
content: "";
position: absolute;
display: inline-block;
left: $start-position; // 0 is flush with start of text
right: $end-position; // 0 is flush with end of text
bottom: $vertical-position; // Positive units move underline closer to text, negative units further away
@arthurattwell
arthurattwell / print-page-setup-lightning-source-colour.css
Last active Mar 3, 2018
CSS page setup for Lightning Source colour books
View print-page-setup-lightning-source-colour.css
/* Page setup for Lightning Source colour pages
* --------------------------------------------
*
* Removes bleed on inside edges
* Adjusts trim accordingly
* Removes crop marks as required by LS
* Uses the @left and @right margin boxes to obscure elements (e.g. full-bleed images)
* that otherwise bleed into the margin area.
* YMMV
*
You can’t perform that action at this time.