This gist describes how to setup a rails backbone project with testing frameworks.
Example Gemfile to start with.
| " Make Nerd Tree smaller | |
| let NERDTreeWinSize=16 | |
| autocmd VimEnter * wincmd l | |
| " have long lines wrap by defaults | |
| set wrap | |
| " change line numberings for ease with writing commands | |
| set relativenumber |
| require 'rspec/core/formatters/base_text_formatter' | |
| module ExtraDoc | |
| def example_passed(example) | |
| example.description << " #{example.metadata[:extra_doc]}" | |
| end | |
| end | |
| RSpec::Core::Formatters::BaseTextFormatter.send(:include, ExtraDoc) |
| namespace 'rails' do | |
| desc 'Renames the current app' | |
| task 'rename' do | |
| # Get the new name | |
| new_name = ENV["NEW_NAME"].capitalize || nil | |
| if new_name.nil? | |
| puts "\nYou must pass in a new name" | |
| exit | |
| end | |
| # config/initializers/will_paginate.rb | |
| module WillPaginate | |
| module ActionView | |
| def will_paginate(collection = nil, options = {}) | |
| options[:renderer] ||= BootstrapLinkRenderer | |
| super.try :html_safe | |
| end | |
| class BootstrapLinkRenderer < LinkRenderer |
| var chart = new Highcharts.Chart({ | |
| chart: { | |
| renderTo: 'container' | |
| }, | |
| xAxis: { | |
| categories: ['Category 1', 'Category 2'] | |
| }, | |
| plotOptions: { | |
| series: { | |
| cursor: 'pointer', |
| 1. Use latest build | |
| gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git' | |
| 2. Create an initializer | |
| # /config/initializers/simple_form.rb | |
| # Use this setup block to configure all options available in SimpleForm. | |
| SimpleForm.setup do |config| | |
| # Wrappers are used by the form builder to generate a complete input. | |
| # You can remove any component from the wrapper, change the order or even |
| class PostPresenter < BasePresenter | |
| presents :post | |
| def published | |
| created_at.to_s(:date_long) | |
| end | |
| def author | |
| post.author_name | |
| end |
| # coding: utf-8 | |
| # | |
| # Encode any codepoint outside the ASCII printable range to an HTML character | |
| # reference (http://bit.ly/KNupLT). | |
| def encode(string) | |
| string.each_codepoint.inject("") do |buffer, cp| | |
| cp = "&#x#{cp.to_s(16)};" unless cp >= 0x20 && cp <= 0x7E | |
| buffer << cp | |
| end | |
| end |
| # Sync with the remote master | |
| git pull | |
| # Force your clone to look like HEAD | |
| git reset --hard | |
| # AGAIN, A WARNING: This can really break stuff! | |
| # Run your filter branch command, replacing all instances of "password" with "your_password" | |
| # The example looks for Ruby files ("*.rb"), you can change this to match your needs |