Runs Previous Command with Replace
For some reason most of my typos happen within iTerm, which is kind of funny when you consider most commands are super short. gut push
doesn't do what I want, nor does hg ammend
or any other command spelled wrong. Then you have to either retype the whole thing or press the up key, place the cursor in the right spot, then update the bad text. Blah.
I recently learned a cool trick for executing the previous command but with a text replacement shortcut:
# `gut push` -- Oooops!
^gut^git # Replaces "gut" with "git" and executes previous command!
# `hg ammend` -- Oooops!
^ammend^amend
No need to retype and no need to fix the text within the entire command. Neat way to save time and get things done!
Regardless of your stance on pornography, it would be impossible to deny the massive impact the adult website industry has had on pushing the web forward. From pushing the browser's video limits to pushing ads through WebSocket so ad blockers don't detect them, you have...
My team mate Edna Piranha is not only an awesome hacker; she's also a fantastic philosopher! Communication and online interactions is a subject that has kept her mind busy for a long time, and it has also resulted in a bunch of interesting experimental projects...
One of the little known HTML5 APIs is the window.postMessage API. window.postMessage
allows for sending data messages between two windows/frames across domains. Essentially window.postMessage acts as cross-domain AJAX without the server shims. Let's take a look at how window.postMessage
works and how you...
I received an email from Ben Delaney a few weeks back about an interesting MooTools script he had written. His script was called FauxSelect and took a list of elements (UL / LI) and transformed it into a beautiful Mac-like SELECT element.
Really cool trick, David! Hadn’t come across this one yet. I’m the curious type so I just had to know what this is called, and any other details… It looks like after a little research that this is a Bash feature, and it’s called “quick substitution”. Its documented under the “Event Designators” section of Bash documentation:
http://www.gnu.org/software/bash/manual/bashref.html#Event-Designators
The documentation specifies the usage as:
But I just tried it out myself and it looks like it works just fine without the trailing caret character. By the way, it’s probably worth noting that this will only replace the first instance of “string1” in the command, so if you misspelled something twice in the command (seems unlikely, I know) you would have to use:
This works with Zsh too.
Thanks Rose Hosting, good catch!
http://zsh.sourceforge.net/Doc/Release/Expansion.html#Overview
If you use zsh, you can enable auto-correction, so if you type
then it will say
This is a great tip.
P.S. Lately, most of my php/css/js related google searches have been showing your site near the top. I have picked up a lot of new things from your site. Whatever you are doing with SEO and content, it is amazing.
All the best.
PPS. I hope one day your have email newsletters.