Updated for Rails 4.0.0+
-
Set up the
bowergem. -
Follow the Bower instructions and list your dependencies in your
bower.json, e.g.// bower.json
{
| // installed Clojure packages: | |
| // | |
| // * BracketHighlighter | |
| // * lispindent | |
| // * SublimeREPL | |
| // * sublime-paredit | |
| { | |
| "word_separators": "/\\()\"',;!@$%^&|+=[]{}`~?", | |
| "paredit_enabled": true, |
| let g:rails_projections = { | |
| \ "config/projections.json": { | |
| \ "command": "projections" | |
| \ }, | |
| \ "spec/features/*_spec.rb": { | |
| \ "command": "feature", | |
| \ "template": "require 'spec_helper'\n\nfeature '%h' do\n\nend", | |
| \ }} | |
| let g:rails_gem_projections = { |
| { | |
| "app/models/*.rb": { | |
| "command": "model", | |
| "affinity": "model", | |
| "alternate": ["unit/models/%s_spec.rb", "spec/models/%s_spec.rb"], | |
| "related": "db/schema.rb#%p", | |
| "template": "class %S\nend" | |
| }, | |
| "spec/factories/*_factory.rb": { |
Updated for Rails 4.0.0+
Set up the bower gem.
Follow the Bower instructions and list your dependencies in your bower.json, e.g.
// bower.json{
| set-option -g prefix ` | |
| set -g base-index 1 | |
| # send ` | |
| bind-key a send-prefix | |
| # start window index of 1 instead of 0 | |
| set-option -g base-index 1 | |
| # Start panes at 1 instead of 0. tmux 1.6 only |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.
| require 'stringio' | |
| require 'timeout' | |
| class Object | |
| def methods_returning(expected, *args, &blk) | |
| old_stdout = $> | |
| $> = StringIO.new | |
| methods.select do |meth| | |
| Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # Elixir has pipes `|>`. Let's try to implement those in Ruby. | |
| # | |
| # I want to write this: | |
| # | |
| # email.body | RemoveSignature | HighlightMentions | :html_safe | |
| # | |
| # instead of: | |
| # | |
| # HighlightMentions.call(RemoveSignature.call(email.body)).html_safe | |
| # |