Favor everything on HEAD in a Git merge conflict

09/28/17  Public, Git

Let's say that you are rebasing your current branch on master, and you run into merge conflicts. For example with a blog.rb file. If you have a situation where you might be inclined to fix it by:

  • going to master
  • copying the entire ...

1 vote - harrylevine

Drop and recreate a rails database

08/31/17  Public, Databases

This will destroy your db and then create it and then migrate your current schema:

rake db:drop db:create db:migrate

From: https://stackoverflow.com/a/4116124/3899985

1 vote - harrylevine

How to edit the /etc/hosts file

09/06/17  Public, Command Line, Online Resources

https://www.tekrevue.com/tip/edit-hosts-file-mac-os-x/

For example, adding:

127.0.0.1    operationcode-psql 

to your /etc/hosts file enables you to run Rails app that uses Docker, without Docker.

As long as postres app i...

1 vote - harrylevine

Iterate over a .yml file's contents

07/01/17  Public, Rails General, Ruby General

Let's assume that the .yml file (i.e. code_school.yml) is located in this directory:

config/code_schools.yml

You'll grab the path to the file, and load its contents:

config = Rails.root + 'config/code_schools.yml'
...

1 vote - harrylevine

Nested Rails Params Hash in a Form

06/11/17  Public, Rails General

When implementing a form object approach, you'll want to create a params hash with nested areas for attributes for two different models.

Note the `manager...

1 vote - harrylevine

Sublime text - jump to top of tree

05/07/17  Public, Shortcuts

  1. control + 0 focuses on the tree
  2. cmd + up-arrow jumps to the top of the tree

1 vote - harrylevine

Shortened, one line version of a spec

04/25/17  Public, Testing / TDD

Here is the full syntax version of a spec:

it "returns no results" do
  expect(results).to be_nil
end

Here is the same spec, in the shortened, one line version:

it { expect(results).to be_nil }

1 vote - harrylevine

Disable an ES lint rule - inline

04/24/17  Public, Other Languages

http://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments

The linting error I was receiving was:

Do not mutate state directly. Use setState()

Here is an example of applying the inline disabling of the r...

1 vote - harrylevine