The Rails Guides are static HTML, so it's incredibly easy to generate and preview them locally.
To get started:
git clone [email protected]:rails/rails.git
cd rails
bundle install --without db
cd guides
bundle exec rake guides:generate:html| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <title></title> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script> | |
| <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script> | |
| <script type="text/javascript"> | |
| var postDefaults = { |
| Backbone.Collection = { | |
| fetch: function() { | |
| var requestUrl; | |
| if (isAFunction(this.url)) { | |
| requestUrl = this.url(); | |
| } else { | |
| requestUrl = this.url; | |
| } | |
| ### ~/.tmux.conf ### | |
| set-option -g default-command "tmux rename-window bash; reattach-to-user-namespace -l bash" | |
| ### ~/bin/tmux-project ### | |
| #!/bin/bash | |
| export SESSION=$(basename $PWD) | |
| # set window title | |
| echo -ne "\033]0;${SESSION}\007" |
| mcantor@cottlebook ~/src/ext/rails/guides (master): bundle exec redcarpet --version | |
| Redcarpet 3.1.2 | |
| mcantor@cottlebook ~/src/ext/rails/guides (master): bundle exec rake guides:generate:html | |
| /Users/mcantor/.rbenv/versions/2.1.0/bin/ruby rails_guides.rb | |
| Generating active_model_basics.md as active_model_basics.html | |
| /Users/mcantor/src/ext/rails/guides/rails_guides/markdown/renderer.rb:18:in `header': wrong number of arguments (2 for 3) (ArgumentError) | |
| from /Users/mcantor/src/ext/rails/guides/rails_guides/markdown.rb:76:in `render' | |
| from /Users/mcantor/src/ext/rails/guides/rails_guides/markdown.rb:76:in `generate_header' | |
| from /Users/mcantor/src/ext/rails/guides/rails_guides/markdown.rb:20:in `render' |
The Rails Guides are static HTML, so it's incredibly easy to generate and preview them locally.
To get started:
git clone [email protected]:rails/rails.git
cd rails
bundle install --without db
cd guides
bundle exec rake guides:generate:html| class Person | |
| class << self | |
| attr_accessor :personalities | |
| # Normally we would do this with 'def self.whatever', but because | |
| # of the class << self idiom above, we're already in the scope of | |
| # the Person class | |
| def whatever | |
| "Hey man" |
| function Animal(name) { | |
| this.name = name; | |
| } | |
| Animal.prototype = { | |
| eat: function() { return this.name + " consumes vital sustenance."; } | |
| }; | |
| function Dog(name, breed) { | |
| this.name = name; |
| # Redirect stdout ( > ) into a named pipe ( >() ) running "tee" | |
| exec > >(tee logfile.txt) | |
| # Without this, only stdout would be captured - i.e. your | |
| # log file would not contain any error messages. | |
| exec 2>&1 |
| require 'ray' | |
| # Prerequisites: | |
| # brew install glew libsndfile | |
| # Tutorial: | |
| # http://mon-ouie.github.io/projects/ray.html | |
| quit_game = Proc.new do | |
| # This method doesn't exist yet. It is defined inside Ray, but since the |
| class CodefileGenerator < Jekyll::Generator | |
| NON_CODE_EXTENSIONS = [ | |
| 'html', | |
| 'md' | |
| ] | |
| is_dotfile = proc { |f| ['.', '..'].include? f } | |
| f_ext = proc { |f| f.slice /\.(.*)$/, 1 } | |
| is_non_codefile = proc { |f| non_code_extensions.include? f_ext[f] } |