Implementation of today’s xkcd in Vim

I couldn’t help myself.

In case you haven’t seen it, the xkcd comic for today plays on the weird configurations we programmers apply to our personal computers. The mouseover text reads: “If used with software that could keep up, a scroll wheel mapped to send a stream of ‘undo’ and ‘redo’ events could be kind of cool.” Well, as it turns out, Vim can “keep up.” All it takes is these two commands:

map <ScrollWheelDown> :undo<CR>
map <ScrollWheelUp> :redo<CR>

Put those in your .vimrc or run them as commands and watch as using the scroll wheel or two-finger trackpad scroll cycles through your history. Enjoy!

Fun fact: the comic alludes to mapping caps lock to control, which is something that Emacs users actually do. Vim users are more partial to mapping caps lock to escape.

Intro to LaTeX slideshow

Last week, I gave a presentation on learning LaTeX to interested UD students as an activity of our ACM Student Chapter. The presentation aimed to cover everything necessary to write a paper or lab report in LaTeX, while also touching on aspects useful for math homework. Fittingly, I created a slideshow using LaTeX (specifically, the Beamer package) to streamline my presentation. Here is that slideshow, in PDF form. For best results, view it in full-screen single-page mode, or “presentation mode,” if your PDF viewer supports it.

Introduction to LaTeX

How to be the guy in “git.txt” (Part 2)

A few months ago, I made a blog post called ‘How to be the guy in “git.txt,”’ referencing the mouseover text of a certain xkcd comic. Here I’d like to expand on that and provide more useful resources.

  1. First, read this tutorial. It discusses different workflows you might use with Git, building up from simpler to more complex workflows. It helps you to understand the idea behind what you’re learning before you really plunge into it.
  2. Next, I again recommend Pro Git, a free online book on how to use Git. You don’t have to commit to reading the whole thing, but just skimming the first 3 chapters can make you much more knowledgeable about Git.
  3. Search the web. Seriously. If you have a question about Git, chances are that someone has already asked it (on StackOverflow, probably). You can learn a lot just by wondering, “How do I do this in Git?” then looking it up. (This really goes for any programming tool.)
  4. man git. I wouldn’t recommend using man pages to learn Git, but they are very useful as a reference. To view the manual page for a specific git command, for example, git merge, use git help merge.
  5. Lastly, I’ll leave you with a cheat sheet I found.

How to be the guy in “git.txt”

I’ve started shying away from graphical Git clients like GitHub Desktop recently. While they’re great for beginners and make visualizing the repository history easy, I wouldn’t want to be dependent on them and be lost when working on a machine that doesn’t have them installed or a remote server via SSH.

The title, for those who don’t know, is a reference to the hover text on xkcd: Git. How can you get to be that person? Check out this flowchart from http://justinhileman.info/article/git-pretty/:

Git flowchart

Of course, this flowchart doesn’t cover everything, and, unlike the guy whose phone number is in git.txt, it doesn’t really talk about branches. You’ll still be lost if you run into merge conflicts, for example. It does, however, cover a few common issues you might run into, like adding a file to your last commit or fixing a commit message (assuming you haven’t pushed/synced). To really master Git, check out the book here: https://git-scm.com/documentation. Also, remember to write better commit messages than these!