Useful Code Snippets

Back to SIG Miscellaneous Tutorials

Global .gitignore setup

Author: Matt Spencer

Date: 2021-08-10

Here is a tip for the group. For files that you wish to add to every repo you work on (such as Makefiles), you can add a global ignore. For ubuntu, edit `~/.gitconfig` and add

[core]
 excludesFile = ~/.gitignore

to the bottom of the file. Then, edit `~/.gitignore` and add any files you need to, just like a project specific repo.

Generate a public URL for local testing

Author: Oliver Baldwin Edwards

Date: 2022-02-01

If you want to test something locally that requires the use of an actual URL—such as updating any Twitter tags—you can use ngrok.

1. Install ngrok.

ngrok

2. Run your server locally.

3. Point ngrok to the port your local server is running on (e.g. `ngrok http 8080`)

4. This should spit something out like:

Session Status                online
Account                       Oliver (Plan: Free)
Version                       2.3.40
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://3848-2600-1700-2f75-20cf-a4ed-6908-759-bf32.ngrok.io -> http://localhost:8080
Forwarding                    https://3848-2600-1700-2f75-20cf-a4ed-6908-759-bf32.ngrok.io -> http://localhost:8080

You can now use the `.ngrok.io` link as a URL to test out your changes. In our example you can pass the website above to the Twitter card validator to make sure your image looks correct.

Twitter card validator