Welcome to the lab.

Lucky Charms, a light color scheme for Sublime Text

[Tweet : nvALT]

I’ve always used dark color schemes for coding. I never use dark themes for writing, and I’m not a fan of Dark Mode in Mojave, but for some reason I’ve always gravitated to light-on-dark for coding. I decided to try a change, and I’ve been quite happy with the results.

I’m still using Sublime Text. As much as I dig many things about VSCode, I haven’t been able to dedicate myself to it and leave behind the comfortable environment I’ve built in Sublime. So this color scheme is for Sublime Text.

I also wrote this theme in the old PLIST format from TextMate which even TextMate doesn’t use anymore. Lack of necessity is the only reason I haven’t converted it to JSON, but feel free to submit a pull request.

I created Lucky Charms based on some of the ideas I loved from the original Espresso editor light theme. Part of my draw to dark themes is the contrast it offers for highlighted syntax. Lucky Charms aims to close that gap for me. It uses transparency and background colors to highlight function names and property keys with blue moons, regular expressions with yellow stars, and strings with green clovers (colors I mean, no emoji involved).

Without further ado, a screenshot:

Grab the theme on GitHub. I haven’t added it to Package Control, but you can just copy the tmTheme file into ~/Library/Application Support/Sublime Text 3/Packages/User/ and open the Sublime Text->Preferences->Color Scheme… menu to use it.

I’ve really only tested it with shell, css, javascript, and ruby files at this point. If you like it and want to expand it for any scopes, please feel free to submit updates (pull requests preferred)!

As always, I’m open to all criticism, but if your complaints are about light themes in general, consider > /dev/null.

Shell Tricks: instant wildcard directory search

[Tweet : nvALT]

Here’s a handy trick I use at the command line to quickly find filenames matching simple wildcard patterns in nested folders. It’s called lsgrep because that’s essentially what it does: grep a list of filenames and return matches.

Dependencies

This function uses The Silver Searcher (ag), which can be installed via Homebrew (brew install the_silver_searcher). It could easily be modified to work with ack or other grep replacement (or grep itself, with the right options).

Installation

Copy the function below into your ~/.bash_profile (or wherever you source functions from at login). Source the file to test it out (e.g. source ~/.bash_profile).

By default it recurses 3 levels deep into folders. You can modify this in the last line by changing the number after the --depth flag.

# Convert simplified wildcard pattern to regex and grep a file listing using
# Silver Searcher (`brew install the_silver_searcher`)
lsgrep ()
{
    NEEDLE="$(echo $@|sed -E 's/\.([a-z0-9]+)$/\\.\1/'|sed -E 's/\?/./'| sed -E 's/[ *]/.*?/g')";
    ag --depth 3 -S -g "$NEEDLE" 2> /dev/null
}

Wildcards

You’ll note that when it creates the $NEEDLE search term, it substitutes basic “*” and “?” wildcards for actual regular expressions. It also escapes “.” to search for a literal period. Spaces are converted to “.*” searches, meaning any number of characters can exist between the arguments. Thus:

$ lsgrep d?rty
source/_posts/2015-09-22-quick-and-dirty-json-validation-in-cocoa.md

$ lsgrep d rty # (or lsgrep d*rty)
node_modules/coffeelint/3rd_party_rules.md
post_backup/2010-11-01-a-little-rock-and-roll-inconsequential-martyr.md
source/_manually_copied/share/InconsequentialMartyr.mp3
source/_manually_copied/share/InconsequentialMartyr.ogg
source/_posts/2010-11-01-a-little-rock-and-roll-inconsequential-martyr.md
source/_posts/2015-03-05-marked-2-dot-4-11-party-like-its-9-dollars-dot-99.md
source/_posts/2015-09-22-quick-and-dirty-json-validation-in-cocoa.md
source/_posts/2016-11-03-great-games-just-in-time-for-the-holidays-sketchparty-tv-and-truth-truth-lie.md

In the first example you can see that the “?” wildcard only allowed one random character between “d” and “rty”, so the file containing “dirty” was returned. In the second example the search was converted to “d.*rty”, so any file with containing a “d” and then an “rty” at any point after is matched.

Limit By Filetype

The literal period substitution allows you to add an extension at the end of the query to limit the filetype.

$ lsgrep d*rty .md
node_modules/coffeelint/3rd_party_rules.md
post_backup/2010-11-01-a-little-rock-and-roll-inconsequential-martyr.md
source/_posts/2010-11-01-a-little-rock-and-roll-inconsequential-martyr.md
source/_posts/2015-03-05-marked-2-dot-4-11-party-like-its-9-dollars-dot-99.md
source/_posts/2015-09-22-quick-and-dirty-json-validation-in-cocoa.md
source/_posts/2016-11-03-great-games-just-in-time-for-the-holidays-sketchparty-tv-and-truth-truth-lie.md

It’s a great shortcut to find files you know the name of, and in iTerm you can then just Command-Click a result to open it in the appropriate editor. You can also use it in another command like cat $(lsgrep d?rty). I hope you find it as useful as I do!

Web Excursions for November 06, 2018

[Tweet : nvALT]

Web excursions brought to you in partnership with MindMeister, the best collaborative mind mapping software out there.

Keeping Chrome Light on Its Feet
I’ve mentioned Workona before, and it remains my favorite tab/window/workspace management solution for Chrome. The developers recently solved the problem of potentially increased CPU usage when you had too many tabs/workspaces open, and now it’s not only the most convenient tab manager, it’s the fastest way to work with a TON of windows and tabs.
Here’s How Much Bots Drive Conversation During News Events

About 60 percent of Twitter activity related to the caravan late last week was driven by bots, according to a new tool aimed at news organizations.

sharkdp/fd: A simple, fast and user-friendly alternative to ‘find’
A handy (and simpler) alternative to ‘find’ in your Terminal.
ncdu - NCurses Disk Usage
A really nice NCurses-based disk utilization CLI that gives you a navigable file tree with file sizes and paths. Drill down to find the disk hogs.
sharkdp/bat
A cat(1) clone that offers paging, colorization, and line numbering as standard options. Just alias cat=bat and go.

Check out MindMeister and start brainstorming, collaborating, and boosting productivity.

The Marked 2 NaNoShaNoWriMo Sale

[Tweet : nvALT]

It’s No-Shave November and National Novel Writing Month. I figured as long as we’re letting our body hair grow while toiling over literary masterpieces, I should probably make sure everyone has the best possible writing tools.

During November, Marked 2 will be 30% off ($9.99). No coupon needed, and the price applies to both the Mac App Store and Direct versions. Go get it while it’s hot!

Even if you’re not joining me in the Marked sale, do check out No-Shave November and help support cancer awareness and research.

Why Every Novel Writer Should Use Markdown

Whether you’re shaving or not, if you’re writing there’s good cause to get into Markdown. Here’s the number one reason: it’s just text.

You don’t have to learn a darn thing. If you’re most concerned about getting words on the page, using a text editor that relieves you of any considerations about formatting, images, and fonts means you focus on getting your ideas out.

Markdown is just plain text, you already know how to write it. You can learn more to add images, links, text emphasis, tables, etc., but for 99% of novel-writing, you don’t need those things anyway.

Marked can show you beautifully formatted versions of what you’re writing without you needing to touch a font palette at all. So pick a text editor, get Marked, and get to writing.

(Additionally, using Markdown and Marked 2 means you’re definitely not using a typewriter, so there’s zero chance for males of catching that beard you’re growing on a carriage return.)

But Is There Anything New?

The latest update (version 2.5.27) just went out. Since I last blogged about it, there have been several releases, including a plethora of improvements and fixes, so here are some highlights:

  • The URL Handler can add new Custom Styles directly from files. See StyleStealer, my recent bookmarklet for turning any web page into a Marked custom style.
  • A full set of Mojave Dark Mode improvements (including fixing the black-on-black “Report Issue” window)
  • Improvements for “Multi Column” mode (choose Multi-Column from the Style menu)
    • Multi-column theme page numbers
    • Multi-column theme document progress indicator
  • New Status bar icons
  • Offer suggestions for Use Alternate marks when highlighting (with default Plain English Campaign word list items only)
  • Highland/Fountain improvements
    • Handle Highland-specific text directives
    • Allow Highland files to be Markdown instead of Fountain
    • Option to process any document as Fountain, even without a Fountain extension
  • In-document search improvements
  • MindNode 5 integration handles both single file and package formats
  • There’s a new preference to syntax highlight only fenced code blocks which have a language specified

Fixes

  • Fixed various crashes
  • Handling of images linked to other images with inline syntax
  • Collapsing sections caused display errors with highlighted code blocks
  • Cmd-D and backtick will now both set a new bookmark at the first available bookmark index
  • IA Block syntax rendered inside fenced code blocks

If you’re not already a Marked-using Markdown lover, take advantage of the November pricing and grab your own copy of Marked 2!

The future of the TabLinks Safari Extension

[Tweet : nvALT]

A long time ago I wrote an extension for Safari called TabLinks. It simply generated Markdown lists of links to all the currently opened tabs. It’s been updated a few times over the years, but recent changes to Apple’s handling of Safari extensions has discouraged me from further updates.

I didn’t realize how many people used and relied on the extension until it was suddenly no longer available. Since the release of macOS Mojave, Apple now requires that extensions be released as apps through the Mac App Store, codesigned and approved by Apple. I could do this, but it’s a lot of extra effort and it’s a pretty simple extension for all that work.

So, what I’m proposing is moving the functionality outside of Safari. There’s already a Service in the Markdown Service Tools that grabs all of the open Safari tabs and inserts a list of them into your text editor. The only thing that TabLinks really added to that was templating, allowing the format of the list to be customizable.

If I expanded that Service to allow templating and the storing of templates in persistent preferences, I think it would cover the needs of those who used TabLinks. What I’m curious about, and putting forth as a question to be answered in the comments is: are there other aspects of TabLinks that you use and would miss? Are there additional features you’d like to add?

Let me know in the comments!

Yours in nerdery,
Brett

Web Excursions for November 01, 2018

[Tweet : nvALT]

Web excursions brought to you in partnership with Udemy. Learn Anything.

Exposing China’s Digital Dystopian Dictatorship
Another disturbing look at the surveillance state cum digital dictatorship in China.
Three Inspiring Role Models Embrace Modern Media To Close The STEM Gender Gap
The fact that interest in STEM among young girls starts waning by the age of 6 is a serious issue to me. Anything that starts turning that tide is a step we need to take.
‎Silenz on the Mac App Store
A cool little macOS utility for people who listen to music on their headphones. When an external sound passing a set threshhold occurs, it will pause your music and amplify the sound through your input device (all customizeable) basically making sure that when someone starts talking to you, you don’t have to pause your music and ask them to repeat themselves.
DesignBase
A well-curated directory of free resources for designers, including plenty of icons, stock photos, and UI mockup kits for Sketch, Photoshop, and more.
Gladys Project
I’ve been feeling guilty about how much of my privacy I think I’ve given up by having Amazon echos around my house, so this Raspberry Pi-based, open-source home assistant has piqued my interest.

Udemy Banner

PopMaker 0.3

[Tweet : nvALT]

I’m releasing a minor update to PopMaker, my little tool for creating custom PopClip extensions. I hadn’t realized that the icon feature had broken, but since I was in there fixing that I made a few other tweaks, mostly layout and error handling.

Also, dark mode, for some reason.

Happy PopClipping to all.

PopMaker v0.3

A Mac application for generating customizable PopClip extensions

Updated Sun Oct 21 2018.

DonateMore info…

The new, improved StyleStealer for Marked 2

[Tweet : nvALT]

I’ve updated the StyleStealer bookmarklet that I published a while ago. In addition to a bit more accurate styling, it can now add styles directly to Marked 2 (2.5.11 or newer) without requiring any file saving or manual adding in Marked’s preferences.

This tool is great if you’re on online writer who wants to see how their work will appear on the destination blog or publication. It’s also great if you like to Markdownify articles and be able to read them later with their original look.

(What it’s not great for is stealing other people’s work and using it to publish your own. Let’s not do that.)

Installation

(If you already have StyleStealer installed, it’s already updated. Congratulations.)

To add it to Safari or Firefox, just drag the button below to your bookmarks/favorites bar.

In the latest version of Chrome, you can no longer drag in-page links to the bookmarks bar. This now requires:

  1. Bookmark the current page to the bookmarks bar (CMD-D or click the star in the url bar)
  2. Right click on the bookmarklet button below and choose “Copy Link Address”
  3. Right click on the new bookmark in the bar and select “Edit…”
  4. Change the Name to the bookmarklet name and paste the copied address into the URL field

(StyleStealer may work in additional browsers, these are the ones I’ve tested.)

styleStealer

Note that the bookmarklet is designed for desktop use, because it uses Marked 2’s url handler it won’t be of much use on mobile browsers.

Usage

YouTube Video

On a page with styling you’d like to duplicate:

  1. Click the bookmarklet
  2. The browser enters inspection mode and a blue bar appears across the top of the page.
  3. Hovering over elements will outline the closest container elements, and show their selector at the top of the screen
  4. Click a container that holds the entire article but not any sidebars or excess cruft

    Note: The outline may disappear when you’re over a paragraph, but the best bet for getting the right section is actually to just click the first paragraph of text in the article/post

  5. Enter a name for the style (defaults to the site name) when prompted
  6. Click the “Add to Marked” link that appears

Done!

The style will appear in Marked’s style picker, as well as in the Preferences->Style->Custom CSS list where you can use the “-“ button to remove it.

When you name the style, it gets written to a file called [name].css in Marked’s application support directory. Using the same name again will overwrite the file, which means if the bookmarklet failed to match the style you can try again and update the existing style. If you have a preview window open and that style selected, Marked will even update the preview live to show you whether it worked or not!

As a technical note, the bookmarklet makes use of Marked’s new URL handler method, addstyle. With this method you can add a style from a url-encoded string or from a file on disk. To add an encoded string, use:

x-marked://addstyle/?name=My+Awesome+Style&css=my%20encoded%20style...

To add from a local file, you can use:

x-marked://addstyle/?file=/Users/myuser/styles/My%20Awesome%20Style.css

(If no name parameter is provided with file, the filename will be used.)

This url method will make it easier to share new styles, and eventually (hopefully) for me to build a style-sharing site for people to share their favorites. For now, if you have a great style you want to share, feel free to add it here or contact me to have me share it for you!