Add security with HTTPS

07/20/15  Public, Rails General

Simply use config.force_ssl = true in your environment configuration.

# config/application.rb
module MyApp
  class Application < Rails::Application
    config.force_ssl = true

You can also selectively enable http...

1 vote - harrylevine

Testing for page content in an RSpec controller spec

07/19/15  Public, Testing / TDD

With RSpec, in a controller spec, you can still test for page content by adding render_views under the
describe block, and using expect(response.body).to have_content('blah blah blah')

require 'rails_helper'
require 'support/d...

1 vote - harrylevine

CSS stylesheet not being included in the application.css tree

07/16/15  Public, Other Languages

If the global application.css isn’t attempting to include per-view stylesheets, add something like this to the top of your view:

<%= stylesheet_link_tag 'support_calls/dashboard' %>

In this example, the path to the view file is...

1 vote - harrylevine

Git squash and merge two commits into one

08/13/15  Public, Git

$ git rebase --abort
$ git rebase --interactive HEAD~2

If you want to squash all of the commits back to origin/master run: $ git rebase -i master


1 vote - harrylevine

Using git bisect to troubleshoot

06/30/15  Public, Troubleshooting

Occasionally, something added to a gem used by one of your projects will break your application. Finding out where, when, and how it broke can be a challenge...

1 vote - harrylevine

Create a link from GitHub that brings you directly to a specifically highlighted set of lines in a file

06/24/15  Public, Git

  1. Navigate to the file in the GitHub repo
  2. Click on the line numbers you want to highlight (use the shift key to highlight multiple lines)
  3. Copy the link from the address bar

1 vote - harrylevine

rbenv not showing the correct ruby version

06/19/15  Public, Ruby General

If you don't see the version of ruby in the list you need when you run rbenv install --list


$ brew update && brew reinstall --HEAD ruby-build

then install the ruby version, i.e. rbenv install 2.2.1


1 vote - harrylevine shortcut

05/24/15  Public, Ruby General

In Ruby code, you quite often see the trick of using an expression like: as a shorthand form of { |element| element.method_name }


1 vote - harrylevine

Load a file into IRB from the root directory's perspective

05/24/15  Public, Command Line

  • Begin withload
  • Followed by a ~, which represents the root directory
  • followed by the file path, from the root directory, to the file in question

For example:

$ load '~/Dropbox/Coding/Sandbox/Random/bench_kill_data.rb'

1 vote - harrylevine