I’m introducing a text / code generation tool that you will fall in love with. If you’re a developer or someone who works with text or tabulated data you need this tool.
It’s called Nimble Text and it’s awesome. Here’s how the developer of Nimble Text describes it:
You can be more awesome at your job by keeping this tool always within reach.
NimbleText is a text manipulation and code generation tool available online or as a free download. It magnifies your ability to perform incredible feats of text and data wrangling.
So it’s a bold claim to say this will make you better at your job. Sounds crazy right?
I have been using this for years (since 2011-2012) and I can tell it’s certainly made me more effective.
Download it and follow along.
How Nimble Text Works
If you look at the screen that comes up when you first run it, you can get a really good idea of how it works.
You paste in some data, usually in columns and rows (Comma, tab separated, etc.) You put in your pattern ($0, $1, etc represents the columns) For each row of data it will substitute the values and display the results.
in the sample above, you can see rows of data that appear to be last name, first name, company name.
So let’s look at the top row. In our substitution pattern we’re creating an email and it shows $1 (2nd column, starts at 0) which we know is a first name. Then we have a period, and then $0 which we know is the last name, then @ $2 .com which we assume will make Initech.com.
One of the coolest parts of this is that the pattern doesn’t need to be line by line and you don’t need to be a Regex expert to do this.
Here’s another example of how you can quickly add quotes around CSV values. This is using data from Mockaroo.
So we take this CSV file and dump it in the input:
Then we use this simple pattern, which puts quotes around all the values:
We press generate, and get this:
It’s that easy! But this is isn’t really impressive, because you probably aren’t doing a ton of CSV format conversions on a daily basis. But there’s a lot of potential here.
How I Use This as a Developer
So there are tons of things you can do with this that are explained on their website. You can do cool things like remove leading trailing and leading spaces or convert spaces to tabs. I love using things like converting to Camel Case and I’ve done weird stuff with Base64 encoding.
I won’t repeat what’s already been written there. I’ll tell you how I’ve been using it all these years.
Let’s take our sample data set:
And we’ll see what we can do with it.
Let’s say I want to make JSON out of this. I would put in a pattern like this:
1 2 3 4 5 6 7 8
Nimbletext then prints this out:
and it will repeat for every row of data. Very cool, and easy.
Make some objects
So as a C# Developer sometimes I’d generate fake data and then use it for Unit testing. With our sample data, I would create a class like this:
1 2 3 4 5 6 7 8 9
Then, let’s say I want to create a collection of these objects. I then enter a pattern like this into Nimble Text:
Then, I click “calculate” and get this:
Which generates a nice set of mocked objects for testing:
1 2 3 4 5 6 7 8 9 10 11 12 13
I have done this countless times over the years. Once you get it into your regular workflow, mocking up data takes seconds.
You can even make SQL statements like this:
The $ONCE variable prints the first statement, then $EACH loops through after that. So you get this in return:
1 2 3 4 5 6 7 8 9 10 11
So this is odd but something I’ve had to do in the past, and Nimble Text works great for it. Here’s how you create an HTML table for our sample data:
1 2 3 4
Click generate and there it is:
A usable HTML table!!
This tool will help you become a better, more effective developer. You can use it for all kinds of code generation. I’ve done some crazy things with the Keywords and Functions in this program. You can write code to generate code.
I’ve seen the most benefit with time savings. Things like mocking data or processing CSVs are boring and tedious. When you’re doing boring tedious things you make mistakes. So once you work this tool into your workflow you’ll work faster with fewer mistakes.
Once it becomes a part of your routine you won’t want to work without it.