Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.
/ gistcard Public archive

Show better gist previews in twitter with a code snippet and a link to the gist

License

Notifications You must be signed in to change notification settings

mike-engel/gistcard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gistcard

Better gist previews on twitter and other open graph applications

gistcard is a better way to share gists (until github does this themselves 😉). It shows a snippet of the gist as a preview using carbon and includes a link to the gist.

Usage

The original inspiration for this was from a tweet from Suz Hinton. It's a wonderful idea, and I fully expect this tool to only last for a little while until GitHub does it officially.

gistcard is meant to only be used on the web, so it only provides a web facing API. There are three parts to it:

  1. An image creator: This creates the image and exposes itself under the url /img/:gistId.png. This uses the Carbon API to crate and serve the image as a PNG.
  2. A forwarder: This provides a barebones HTML page that uses the existing meta tags from the official gist page, and adds the proper image source for the code preview. Upon visiting, it immediately redirects to the gist page.
  3. A UI: This provides a simple landing page to demonstrate how to use it and to generate a URL to paste, if needed.

For ease of use, the gist for the page can be the full url of the gist (with or without the username), or just the ID. All three of the following are valid URLs!

The image URL will always use the gist's ID, like so: https://gistcard.now.sh/img/a1c11cd6d0edcdab6fd912619b33d972.png.

Contributing

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

I would love to see issues and pull requests to make this a better tool that works for people other than myself!

This project only works with rust's 2018 edition. Thus, you must have version 1.31 or later. Once you have rust installed, you can then run cargo build to see it in action. This will download and compile all the dependencies in development mode.

In theory, you can use now's now dev, but as of this writing, the rust support still needs some work. In the meantime, you could build a simple binary that uses the library, or you can deploy it to your own zeit account. If you need help, please submit an issue and I'll be happy to try and help you out.

About

Show better gist previews in twitter with a code snippet and a link to the gist

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published