https://github.com/thinkswan/rails-sidekiq-code-snippets
A Rails app that manages a library of code snippets and uses Sidekiq workers to apply syntax highlighting.
https://github.com/thinkswan/rails-sidekiq-code-snippets
ruby ruby-on-rails sidekiq tutorial
Last synced: 5 months ago
JSON representation
A Rails app that manages a library of code snippets and uses Sidekiq workers to apply syntax highlighting.
- Host: GitHub
- URL: https://github.com/thinkswan/rails-sidekiq-code-snippets
- Owner: thinkswan
- License: mit
- Created: 2019-06-28T08:52:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-09T15:24:47.000Z (over 4 years ago)
- Last Synced: 2025-01-03T19:23:47.202Z (6 months ago)
- Topics: ruby, ruby-on-rails, sidekiq, tutorial
- Language: Ruby
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rails-sidekiq-code-snippets
A Rails app that manages a library of code snippets and uses Sidekiq workers to
apply syntax highlighting.Based on the tutorial found at http://railscasts.com/episodes/366-sidekiq.
## How to use
#### Clone the repo
```
git clone [email protected]:thinkswan/rails-sidekiq-code-snippets.git
```#### Install Redis
If you're using Homebrew:
```
brew install redis
redis-server /usr/local/etc/redis.conf
```If you prefer to install from source:
* http://redis.io/download#installation
#### Install gems and set database up
```
gem install foreman
bundle install
bin/rake db:setup
```#### Start server and Sidekiq workers
```
foreman start
```This will start a server at http://localhost:3000.
To monitor the Sidekiq workers, open http://localhost:3000/sidekiq in a separate
tab.
## How it works
The Rails app is a basic CRUD application that allows you to manage code
snippets. It is backed by an SQLite3 database.When you create or modify a snippet, a Sidekiq worker (`SnippetHighlighter`) is
enqueued. This worker sends the code snippet and specified language to a [public
syntax highlighting API](http://markup.su/highlighter/api) and saves the result
when finished.Note that when you first create or modify a snippet, you will see the plain
code when the request completes. This is because the syntax highlighting job has
not been picked off the queue yet.
Once a worker finishes the job, you can refresh the page to see the
syntax highlighted version of the snippet.
## License
MIT