Tag: files

How to upload your speaker slides to your GitHub repo – 058

If you give talks or want to upload extra documentation or slides to your repos, you have a couple of options!

1. Push your PowerPoint slides to your repo to retain a copy

First, you can simply upload your slides, e.g. .ppt or .pptx, to your repo.

ppt file in a repo

You won’t be able to see the slides when you click on the PowerPoint filename, but anyone who clicks on View Raw will download the deck.

powerpoint deck uploaded to GitHub

2. Push a PDF of your slides to your repo for others to view without downloading

Next If you save your PowerPoint slides as a PDF and push those to GitHub,

pdf file in a repo

GitHub will render your PDF files as subsequent images.

PDF slides shown as subsequent images

Note re diff’ing

Unfortunately, because these are binary files, you won’t be able to see any rich diff information for the commit.

Binary file not shown for powerpoint or pdf commit diff

How to write your repo README in a markup language other than markdown – 057

Markdown not your thing? GitHub supports more than just markdown for your Readme markup language. You can view the full list of supported markup languages.

For example, the following readme is written in Creole instead of markdown.

repo README written in Creole

The code used to render readmes on GitHub is an open source project called Markup which is accepting contributions.

Now if you’re like me and love to break software by trying different combinations of things, you might ask, “What happens if I add both a README.md and a README.creole or other markup language file?” It looks like the first readme file that got created wins (i.e. the readme that is displayed). If you delete the readme file being shown (e.g. README.creole as shown in my example) and you’ve already added a README.md file, the README.md file’s contents will be displayed.

How to render a CSV and TSV file as an interactive table on GitHub – 056

If you have a csv or tsv file in your repo, GitHub will automatically display it as a table that you can search and filter on.

csv file displayed as table

Similar to source code, you can click a row (or shift+click multiple rows) to highlight, and copy that URL to send to someone, e.g. https://github.com/saraford-tips/fluffy-octo-robot/blob/master/inventory.csv#L6-L8

Multiple rows highlighted

You can also search within the spreadsheet. Although I couldn’t find a keyboard shortcut, as ‘s’ goes to the overall search this repo search box.

Search within table

How to press ‘y’ to navigate to the permalink for a file’s exact commit ID on GitHub.com – 052

Suppose you had a question about the contents of a file at an exact moment in time (or in git-speak: at an exact commit in time). If you were to visit the repo and navigate directly either to a file or the line in question in a file, e.g. https://github.com/saraford/your-moment-of-github-zen/blob/master/main.js#L74 showing the line

mainWindow.webContents.openDevTools();

you might forget or not even realize (like me) that you’re copying the link for the latest version of that file on master (or in git-speak: the version of the file at the current head of master).

In other words, if someone were to come along and make a change to this file, your link to this line of code at the latest commit on master might be a link to a totally different line of code instead of the openDevTools() link.

Press the `y` key and you’ll see that the page seems to refresh. Well, yes and no. The page has updated, but look at the URL now.

https://github.com/saraford/your-moment-of-github-zen/blob/f06f035cfed7c0ea05db8bd3cc25b22c43cea6d7/main.js#L74

now you got the permalink to that exact line of code!

This shortcut is the functional equivalent of clicking Code – Commit – Browse the repository at this point in the history – clicking the file (e.g. main.js) – and then clicking the line number.

This shortcut works for any branch name, specific commit SHAs, and tags, according to the docs. E.g. suppose you were looking at main.js on a branch called windows-fix located at https://github.com/saraford-tips/your-moment-of-github-zen/blob/windows-fix/main.js and you pressed the `y` key. The URL would change to https://github.com/saraford-tips/your-moment-of-github-zen/blob/811aacbd492044c8a02536129edf42862d0a593d/main.js

I hate not having a photo to go alongside a tip, so here’s a picture of a Great Dane next to a small (terrier?) dog, aka how I feel standing next to tall people.

Great Dane standing next to small dog

photo taken from https://flic.kr/p/b4RGX8