How to search better with Atom

I’ve been using Atom as my text editor for longer than any other text editor now, after using Textmate, Sublime Text, and Vim for a couple of years each. In this post, I show a little tip I’ve discovered to help make searching more powerful.

Using Atom?

I like using Atom as an editor.

It’s free, open source, polished, under constant development in the open with a well funded team, and on the whole, I agree with Alex Payne’s post about the flight to old text editors feeling like mis-step.

It’s easy enough to start with, and can adapt to work well with many, many languages. It’s what I’d recommend to most people learning to code too.

However, because it isn’t a full IDE, you do need to know how to use the search tools to get the most from it.

Searching for things that match one pattern, but not another

As the wonderful flight manual from Atom editor describes in more detail, you can search in within files, and search within projects easily, by hitting cmd+F to search in a file, and cmd+shift+F to search across your project.

This is nice, and it’s common to search for a pattern like some_function  or some class like Page in your existing project.

This example here shows a personal site I used to run, searching for mentions of Page in an django project:

Screen Shot 2017-05-11 at 22.13.25.png
I’m getting all kinds of maches, including ones in files I don’t want

However, lets say you’re working on an app, where you’re sure you don’t want to look in some kinds of files that also end in .py. This might be some migration files, which are written in python, but you know you won’t want to look in them for code that controls how an application works right now. To filter out all the migration files, you can and a second negated pattern, by adding the bang/exclamation mark instead, like so:

Screen Shot 2017-05-11 at 22.13.47.png
That’s more like it, no migration files in the search results. Huzzah!

This is, really, really handy when working with javascript projects, and huge node_modules directories. More here in this forum thread on discuss.atom.io.

Searching across files you normally want to ignore in a project

The other handy trick I’ve started using a fair amount of late, and especially since I started writing in javascript and python more is toggling the search behaviour between to ignore the files that you have told git to ignore with a .gitignore file, and including them when you’re trying to understand where a given bit of code came from.

You can do this the quick and dirty way by opening up Atom’s config file here:

Screen Shot 2017-05-11 at 22.25.08.png

And in the config.cson file that’s presented ​to you, making sure you have this property set to either true or false:

“*”:
core:
excludeVcsIgnoredPaths: true

If you have this set to true, you’ll have faster searching of just the files and folders you have decided to ignore with your gitignore file. But if you do need to search for something in something like a node_modules folder in javascript, in a virtual environment in Python, you can toggle this by setting this value to true or false.

I only really discovered these this year, and it’s not something I new how to do before, and I figured Atom others might find it useful too.

Hope it helps, and happy searching! If you use Atom, and there are any other gems like this, feel free to add a comment below.

 

 

Reviewing the options for setting up a small website, and ending up with WordPress

After spending a frankly depressing amount of time trying out various options, I’ve recently set up this blog, and a recent project blog, the Amateur Wardley Mapping User Group, to run on WordPress.com. For my future self to check as much as anyone else, I’ll explain my reasons for doing.

I have a fair few friends who don’t have a well established website, but want one, and aren’t really sure where to start.

After a few years of running my own blog, on my own servers, I’m in a similar situation – at some point, I had had enough of logging into a CentOS box, that I set up in 2010, so I put all files on the box into some object storage bucket, as well as the entire machine image and pulled the plug. I put some placeholder site up, and promised myself I’d have a full site set up in a few weeks, on a fresh server, where I’m not responsible for keeping backups safe and so on.

Screen Shot 2017-05-08 at 22.38.52

More than 9 months later

That placeholder site is still up, but I’ve now set up this blog on WordPress.com, which I’m moving selected content over week by week. I’ll probably keep the blog subdomain, and host the majority of written content there from now on.

Why?

Moving content around is a pain, but slightly less of pain with WP

I’ve carried out a number of content migrations in various, and without exception, migrating content has been a pain. Where possible, I now want any content I write to be in as common a format as possible, to avoid this pain in future.

WordPress now powers huge chunk of the internet, and there’s value in being part of that ecosystem – WordPress’s export format is pretty close to an industry standard for storing content now, and moving it around.

If you put content into WordPress, there are clear paths for getting it back out again, and into other systems, in a well-structured fashion.

I want to write more than tinker with my site

When you run your own WordPress site, it’s easy to spend ages creating themes, looking around for plugins, and trying to work out how to make them all work nicely together, then invent all kind of convoluted workflows for keeping things in source control, and building weird deployment pipelines, for a perfect writing workflow, rather than actually writing.

By using WordPress.com, I still have the relative of freedom to leave, and move content away, but having someone else manage the user experience is quite liberating. Like with Tumblr or other tools, I’m not fiddling with settings so much, and when I’ve written on wordpress.com blogs before, I’ve been able to focus on communicating with others more.

Writing on WordPress doesn’t feel like it has quite the same focus on content as writing in Medium does, but it’s at least it’s clear how Automattic, the company behind WordPress.com makes money.

I think the WordPress writing experience is going to continue to get better faster than other tools

On the subject of user experience, while writing in WordPress isn’t bad, there are other competitors that also offer a nice place to write online:

Screen Shot 2017-05-08 at 22.19.29

If you’re looking for a polished open source CMS to run, Wagtail, a Django app is the closest I’ve seen to combine WordPress’s ease of use, with some interesting thinking about structured blocks of content, expressed as Streamfields, and explained by Matt Westcott’s article Rich Text fields and Faster Horses.

A few years ago, Poetica offered a really well thought through writing experience, that you could use inside wordpress itself as your editor.

banner-772x250

Elsewhere, for many of us, Google docs, has effectively become the de facto place where content is written before we paste it into a blog editor.

If you really like Markdown, and source control, and you tend not to use many images anyway, there are now many, many static sites generators now, promising an unhackable, fast site, like Pelican, Jekyll, Cryogen

Finally, I think Medum’s writing experience is probably the most enjoyable one online right now. From writing, to asking for feedback on a draft, to seeing highlights and comments  on writing you’ve published, very much feels like the benchmark writing online will be judged against from now on.

I looked at all of these, setting them up, writing with them and trying publishing/deployment workflow.

I ended up with WordPress, partly because I wherever there was a strength one of the options had over it, I could see a decent response from the product team at Automattic.

WordPress’s responses to these threats

With my Product Manager hat on, seeing Automatic respond to these threats is fascinating:

google-docs-for-wp-com

Google Docs for WordPress.com, which lets you collaborate with others, then publish directly from Google Docs to a WordPress site feels like a pragmatic response to how people really write online. It also deftly provides an alternative right now for people clamour for the collaboration and commentary tools that Poetica and Medium offer.

Elsewhere, you can see experiments in editor UI by the Automattic on with Project Gutenberg  and this post by Davide Casali, about mental models for text editors give an idea of how the team are thinking about writing online in future.

On the speed / security front – having a fast hosted service, with a dedicated security team offers many of the upsides of static sites – in each case, you’re less exposed to being hacked for different reasons, you’re probably at less of a risk than if you ran it yourself. It’s also cheap enough, to feel comprable to using a static site too. For me, the cost of WordPress.com, on a personal plan offers many of the upsides of a static site (my own domain name, fast loading, no servers to worry about), at price point that is pretty easy to swallow.

So those are my reasons. Let’s see if I can stick to them and actually keep getting posts our the door in 2017…

Handy snippets – Python without the .pyc cruft

I maintain a huge workflowy file of snippets and tricks and, I suspect some of them will be handy for others to use too. I’m going to sharing them regularly, when I’m not sure what to write, mainly to keep the habit of blogging, until it comes naturally.

Part of my professional life, involves me writing a fair amount of python code. When you write python, you end up creating lots of files ending with .py, but when you run the code, you end up with compiled python files, sending in pyc.

If you don’t want loads of pyc files crufting up your workspace, and you’re workignon the command line, there’s a handy little environment variable you can set in your shell, to banish those ugly files once and for good. Run this command before working (or better yet, make it run whenever you open a terminal window):


export PYTHONDONTWRITEBYTECODE=1

See, isn’t that better?

I picked up this gem from the Hitchhiker’s Guide to Python, a free, opinionated book from Kenneth Reitz about good practices with working with Python. Reading it will almost certainly improve your python – I know mine is better as a result of spending some looking over it.

Value Chain Mapping by example with Growing Communities

Through my company Product Science, for the last three years I’ve been working with Growing Communities a non-profit organisation set up in the 90s to get good, fairly traded, organic food to people in a neighbourhood, in an environmentally, socially, and financially sustainable way. In the summer of 2015, during a strategy planning workshop together we used Simon Wardley’s Value Mapping technique (often referred to as Wardley mapping) to help work out a strategy for a key part of the organisation’s activity: their weekly veg scheme. With their permission, I’m sharing this write-up to help share examples of using Wardley maps in the wild, as a handy reference point for others. Continue reading “Value Chain Mapping by example with Growing Communities”