QA Graphic

TextExpander URL Subdomain Slicer

Today's snippet example is highlighting the power of built in JavaScript utilities with TextExpander. Both are pretty powerful tools and lots of flexibility. Together they make you super productive.

subdomain_js.jpg

JavaScript has a lot of very cool built in text utilities. You can easily implement some of these in TextExpander. This week we are going to look at a cool use of the JavaScript slice tool.

In my testing enviroment we have different subdomains and sometimes I just need to reference the one I am working on. So I created this simple TextExpander JavaScript snippet:

JavaScript Snippet

var mylocation = '%clipboard';
var start = mylocation.indexOf("://")+3;
var end = mylocation.indexOf(".")
var domain = mylocation.slice(start,end);
domain;

Snippet Abbreviation

ddomain

Real World Use

When I comment in a ticket, I can now easily reference the server that I am working on as part of the description text:

I am encountering a problem on the dev20 server when trying to login:
https://dev20.serverbot.com/login

 

About

I find TextExpander, by Smile on My Mac, to be an awesome productivity tool. This past winter, I posted some cool snippets that demonstrate the power of the application. Occasionally, I will post some new snippets that I think will be useful in anyone's TextExpander library.

Schedule

SaturdayInternet Tools
SundayOpen Topic
MondayMedia Monday
TuesdayQA
WednesdayAffinity
ThursdayBBEdit
FridayMacintosh