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

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gistcard

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

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!

Rust bits

This project only works with rust's 2018 edition. Thus, you must have version 1.31 or later. Once you have rust installed (I recommend rustup), 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.

UI bits

The UI is built with Gatsby, Styled Components, and typescript. To start, run npm install from within the site folder to download all of the dependencies.

If you wish to use now dev, run that from the root directory. This should then be available at http:https://localhost:3000.

To use Gatsby's develop mode, run npm run dev from wihin the site directory. The URL will be printed to the console, but it is usually http:https://localhost:8000.

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