When working with regular expressions, it can be difficult to understand why a particualar pattern is not working as you would expect.
The visual debug tool at debuggex.com makes it much easier to step through and actually visualize how a pattern is working or, as is often the case, not working.
Here is an overview of how it works.
I found this regex useful when parsing log files to find everything except the data I needed. I can select and delete everything I don’t need and I am left with the lines of data I can work with. Continue reading “Regex – Find everything except – Caret”
I wrote this plugin for Sublime Text to help on a project where I am localizing a lot of text.
I found I was copy and pasting the same i18n methods over and over so I decided that there must be a relatively easy way to automate this using a plugin.
Now I select some text, press my key shortcut and the text gets replaced with the appropriate i18n method.
Continue reading “WordPress Localization Plugin for Sublime Text”
Every few days, I had an issue where my startup disk was full and emptying the trash just wasn’t doing enough.
I found the following command online that searches a file system for files over 500MB and prints the file path. It identified files I had totally forgotten about as well as some huge files generated by apps I no longer used.
sudo find / -size +500000 -print
I then used the rm command to delete files. When deleting entire directories I used the recursive flag (be careful!)
rm -rf <directory path>
Kudos to davidcraddock.net
Here is a command line method to replace a string in multiple files in the current and sub directories.
Continue reading “String replace in multiple files using a recursive file search”
Here is a command to get a list of modified files in a directory and subdirectories;
Continue reading “Get list of modified files in directory”
Here are a bunch of online tools I use to tidy, format and optimize code.
Continue reading “Online tools to tidy, format and optimize code”
You may want to copy the contents of one folder to another, but if the original folder is already added to Subversion (SVN) you get an error when committing the new folder.
When a folder is committed to SVN, a
.svn folder is added to each folder within the folder subdirectory. To un-add the folder from SVN, you simply remove this
To save time, you can remove all
.svn folders within the folder subdirectory by using the following command.
Continue reading “Remove all .svn folders in subdirectory”
Found this super handy cheat sheet for regular expressions.
Regular Expressions Cheat Sheet
Also, this serves as a useful reminder when returning to regular expressions.
Continue reading “Regular Expressions Cheat Sheet & Practical Uses”
Excellent post from one of my favourite sites – Become a command line ninja with these time saving shortcuts