Skip to content

Instantly share code, notes, and snippets.

@narthur
narthur / adjustTableWidths.jsx
Last active May 22, 2024 09:26
InDesign JSX User Script to Adjust Table Widths Relative to Frame Width
// Inspiration:
// https://forums.adobe.com/message/2524327
// http://www.indiscripts.com/post/2009/10/work-around-the-width-height-gap
var myDoc = app.activeDocument;
function getWidth(/*PageItem*/obj, /*bool*/visible)
// return the [width,height] of <obj>
// according to its (geometric|visible)Bounds
{
@narthur
narthur / TablesToText.jsx
Created June 11, 2015 15:24
InDesign script for converting tables to text
// Based on https://forums.adobe.com/thread/578555
var myDoc=app.activeDocument;
tableList = myDoc.textFrames.everyItem().tables.everyItem();
tableList.convertToText("\t","\r");
@narthur
narthur / removeDoubleTabs.jsx
Created June 11, 2015 15:26
InDesign script for replacing double tabs with single tabs
//Based on http://wwwimages.adobe.com/content/dam/Adobe/en/products/indesign/pdfs/InDesignCS5_ScriptingGuide_JS.pdf
var myDocument = app.activeDocument;
//Clear the find/change text preferences.
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
//Set the find options.
app.findChangeTextOptions.caseSensitive = false;
app.findChangeTextOptions.includeFootnotes = false;
app.findChangeTextOptions.includeHiddenLayers = false;
app.findChangeTextOptions.includeLockedLayersForFind = false;
@narthur
narthur / sendItToMany.sh
Last active March 24, 2022 08:16
Send email attachment to multiple recipients using Mutt
a="[email protected], [email protected]"
mutt -s "subject" -a file.pdf -- $a
@narthur
narthur / stopwatch.sh
Created January 12, 2016 19:08
Use Terminal as a stop watch
# To start stopwatch:
time cat
# To stop stopwatch:
ctrl+c
@narthur
narthur / findLargestFile.sh
Created January 12, 2016 19:10
Find largest file recursively
sudo find /path/to/search/ -size +15M -printf "%s - %p\n" | sort -n | tail
@narthur
narthur / listBySizeRecursively.sh
Created January 12, 2016 19:11
Sort contents by file size recursively
ls -RlhS
# -R: recursive
# -l: long listing
# -h: human readable file sizes
# -S: sort by file size
@narthur
narthur / compareDirectories.sh
Last active January 26, 2016 15:32
Compare two directories recursively
# Source: http://www.unixtutorial.org/2008/06/how-to-compare-directories-in-unix/
diff --recursive --brief /tmp/dir1 /tmp/dir2
@narthur
narthur / getDirSize.sh
Created January 26, 2016 15:38
Get size of a directory in Unix terminal
# Source: http://unix.stackexchange.com/a/3021/138212
du -sh directory_name
@narthur
narthur / enable_wp_debugging.php
Created March 13, 2016 17:16
Enable WordPress debugging
// Source: https://www.smashingmagazine.com/2011/03/ten-things-every-wordpress-plugin-developer-should-know/
// Replace `define('WP_DEBUG', false);` in `wp-config.php` with the following lines:
// Turns WordPress debugging on
define('WP_DEBUG', true);
// Tells WordPress to log everything to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Doesn't force the PHP 'display_errors' variable to be on