Giter VIP home page Giter VIP logo

roughdraft's Introduction

Roughdraft

A Ruby implementation of Gist.io built with Sinatra.

Usage

View a gist at roughdraft.dev/gist-id. Example: roughdraft.dev/4370358

View a list of a GitHub user's Gists at username.roughdraft.dev. Example jedfoster.roughdraft.dev. Only public Gists with renderable content are listed.

If you happen to be on a user subdomain, e.g. jedfoster.roughdraft.dev, and you paste in a Gist ID that does not belong to that user, you will be redirected to the appropriate subdomain. Example: jedfoster.roughdraft.dev/4731881 will redirect to blackfalcon.roughdraft.dev, because jedfoster does not own that Gist.

Roughdraft supports GitHub Flavored Markdown, Textile, Haml, and plain text.

GitHub Flavored Markdown includes a number of improvements over Markdown, like fenced code blocks with syntax highlighting. Example:

```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```

Roughdraft's implementation of Haml does not support Ruby evaluation, and many Haml filters will result errors.

Plain text is rendered as Markdown.

Installation: Local

The app:

git clone https://github.com/jedfoster/Roughdraft.git
cd Roughdraft
mkdir tmp
touch tmp/restart.txt

Change the APP_DOMAIN constant in roughdraft.rb, line 68, to whatever local domain you want to use. I recommend using Pow for local development, especially on this project as the username subdomain feature doesn't work with IP addresses.

The GitHub API limits the number of unauthenticated requests to 60 per hour, which is too little for production and often even for development. To get around this you will need to register your app with GitHub. Once you have your client ID and secret, rename config/github.example.yml to config/github.yml and paste in your app's credentials. Mine looks something like this:

client_id: 9ef1xxxx
client_secret: 5784xxxxxxxx

You should now be able to submit up to 5000 requests per hour.

FAIR WARNING: Your client ID and secret should not be shared publicly. Do not commit github.yml to your repo, especially if you post your repo on GitHub. Read the instructions for configuring Heroku with your credentials, below.

# Restart Pow
touch tmp/restart.txt
# Rock and Roll

Installation: Heroku

heroku create
git push heroku
heroku open
# Rock and Roll

Change the APP_DOMAIN constant in roughdraft.rb, line 41, to whatever custom domain your app will use.

The user subdomain feature doesn't seem to work without a custom domain name (i.e. not the Heroku generated domain.) This may be fixed in a future release. See this article on custom domain names and Heroku.

GitHub authentication on Heroku

Since the YAML file with your API credentials is not committed to your repo, it won't be sent to Heroku, so we need another way of storing that information. Enter Heroku environment variables:

heroku config:set GITHUB_ID=9ef1xxxx
heroku config:set GITHUB_SECRET=5784xxxxxxxx
heroku open
# Rock and Roll, again.

roughdraft's People

Contributors

jedfoster avatar blackfalcon avatar

Stargazers

Mathew Tyler avatar Tyler Quiring avatar Bob Blanchett avatar 吴雪 avatar Antonio Rodrigues avatar Cobb avatar Anthony N. Carrillo avatar Gaurav K avatar James Miranda avatar  avatar  avatar Thejesh GN avatar Hemin Won avatar Josh L avatar vincent avatar  avatar xiaofeig avatar Henrique Lacreta Alves avatar Thaddeus avatar Ilaria Varriale avatar  avatar Scott Opell avatar Damien avatar  avatar downgoon avatar Viraj G. Kulkarni (विराज गु. कुलकर्णी) avatar flywhale avatar  avatar  avatar Emmanuel Château-Dutier avatar danielsdesk avatar Xiangming Zeng avatar  avatar Helphi He avatar Paul L. Maurizio avatar Huang Zonghao avatar  avatar Mike King avatar Haojie Xu avatar Paul Young avatar Andréy Lesnikóv avatar t͡ɕ∱ບຮɐດອ² avatar  avatar AJ Weeks avatar Gabriel Glachant avatar Chai Phonbopit avatar Daniel Bayley avatar yang kai avatar wimpunk avatar Michael Hemp avatar Joshua Ray avatar Chris Penner avatar Krzysztof Kowalczyk avatar Leonardo Azenha avatar Ari Bader-Natal avatar Madhav Jha avatar tsmsogn avatar Su Shi avatar  avatar Athan avatar Saji Nediyanchath avatar Merlin Gaillard avatar Stefan Kersten avatar Steinway Wu avatar Dean Rather avatar Stéphane Busso avatar Joohun, Maeng avatar Ben Peachey avatar Debashish Ghatak avatar Ferri Sutanto avatar Elizabeth Stanley avatar Eric Casthart avatar Robin Scott avatar António P. P. Almeida avatar Kaushalya R. Mandaliya avatar Alex Carpenter avatar Dany Shaanan avatar Adrienne L. Travis avatar Nazeeruddin Ikram avatar JT5D avatar A.G. avatar Ben Tsai avatar Dan Blanchard avatar Yuya Saito avatar Jonah Ruiz avatar Henry Blyth avatar Idan Gazit avatar Michael Fairchild avatar  avatar Tom Bamford avatar  avatar

Watchers

Idan Gazit avatar  avatar Jeff Dickey avatar wimpunk avatar A.G. avatar shifter avatar t͡ɕ∱ບຮɐດອ² avatar  avatar

roughdraft's Issues

GitHub login

A user should be able to login with their GH account.

Graceful failure

Need to fail much more gracefully when the app runs into problems like API endpoint communication failure or parsing issues.

Fix gaps in user gist lists

If a user has only 1 or 2 renderable Gists in a paginated list, that page on RD looks empty.

For example, right now I only have 1 Gist listed on http://jedfoster.roughdraft.dev/page/1, because I had a spate of Sassmeister Gists.

Not sure of the best solution. Perhaps pull the next page if the current result set is below a certain count. Or, pull a much larger set and paginate it ourselves. We're caching, so performance impact should be limited.

RSS feed

Would be cool to have an RSS feed for each user.

Support Gist file names

When editing or creating a Gist, user should be able to name files, just like on GitHub.

Right now, when creating a new Gist we auto-name the Markdown file with, roughdraft-file1.md. The user should be able to name it.

But we should enforce the .md extension somehow.

Home page

Needs a home page. Should be a Gist.

Broken Syntax Highlighting

There are quite a few code blocks that have incorrect syntax highlighting when compared to their raw gist.

Example: the code block below ^ concatonates strings on this article

Support private Gists

Support rendering private Gists. Private Gists should not be listed, but should be rendered at /:private_gist_hash

Fix leading white space in code blocks

Phantom white space is being injected at the start of code blocks. I suspect this is because of white space between the opening <pre> tag and the opening <code> tag.

screen shot 2013-06-27 at 10 14 17 am

Help documentation

Need some documentation on formatting and usage.

Cover:

  • GitHub-flavored Markdown, differences from standard Markdown
  • User pages

Edit Gists

A user should be able to edit an existing Gist

Support anonymous gists

Anonymous gists create a 500 error on roughtdraft.io.

Example: roughdraft.io/fce1b9328f098ce5c40f

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.