Gist your GitHub and Bitbucket repositories

Gistfy is an easy way to create embeddable code snippets from your GitHub and Bitbucket repositories or your GitHub Gist.


Try

Result

Add this snippet to your page
<script type='text/javascript' src='{{ result.url }}'></script>
And this will be the result

API

Gistfy a Gist from GitHub

<script type='text/javascript' src='http://www.gistfy.com/github/gist/:id'></script>
Parameters
Name Type Description
lang string Set programming language used for code highlighting. For example, lang=python. See supported languages here.
slice int Show only selected lines. For example, slice=1 show only line 1, slice=-1 show only the last line, slice=1: skip the first line, slice=:-2 skip the last line, slice=1:4 show lines 1 through 4, slice=-5:-1 show (last - 5) line through last line.
style string Set CSS color scheme. Can be github, monokai or monokai_sublime. Default: github. For example, style=monokai.
type string Set response type. Can be js or html. For example, type=js for JavaScript to be used with script tag and type=html for HTML to be used with AngularJS or jQuery.

Gistfy a file from Bitbucket or GitHub

<script type='text/javascript' src='http://www.gistfy.com/:host/:user/:repo/:path'></script>
Parameters
Name Type Description
branch string Set branch or changeset to be used. Default is master. For example, branch=0ff893db335695744dfed3d3e4be4eb4f9815534 to use a specific changeset.
lang string Set programming language used for code highlighting. For example, lang=python. See supported languages here.
slice int Show only selected lines. For example, slice=1 show only line 1, slice=-1 show only the last line, slice=1: skip the first line, slice=:-2 skip the last line, slice=1:4 show lines 1 through 4, slice=-5:-1 show (last - 5) line through last line.
style string Set CSS color scheme. Can be github, monokai or monokai_sublime. Default: github. For example, style=monokai.
type string Set response type. Can be js or html. For example, type=js for JavaScript to be used with script tag and type=html for HTML to be used with AngularJS or jQuery.

Usage

Full working samples in AngularJS, jQuery and HTML.

AngularJS

jQuery

HTML

Gistfy gist examples

These examples are based on highlight.js examples. Most snippets do not contain working code.

C++
CSS
Java
Python

Author

This project is maintained by Alexandre Vicenzi.

License

The MIT License (MIT)

Copyright (c) 2014 Alexandre Vicenzi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.