Skip to content

Instantly share code, notes, and snippets.

View andersennl's full-sized avatar

Nikolaj Andersen andersennl

  • Lynx
  • Berlin, Germany
View GitHub Profile
@andersennl
andersennl / Brewupdateissues
Last active August 29, 2015 14:03
Brew update issues
➜ folder brew update
error: Your local changes to the following files would be overwritten by merge:
Library/Formula/readline.rb
Please, commit your changes or stash them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
➜ folder brew --config
HOMEBREW_VERSION: 0.9.5
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
MyExceptions = [RangeError, RegexpError, IOError].freeze
begin
raise IOError, "should be rescued"
rescue *MyExceptions => e
puts e
end
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@andersennl
andersennl / blog.md
Created May 1, 2018 04:37 — forked from JacobBennett/blog.md
Clean up your Vue modules with ES6 Arrow Functions

Recently when refactoring a Vue 1.0 application, I utilized ES6 arrow functions to clean up the code and make things a bit more consistent before updating to Vue 2.0. Along the way I made a few mistakes and wanted to share the lessons I learned as well as offer a few conventions that I will be using in my Vue applications moving forward.

The best way to explain this is with an example so lets start there. I'm going to throw a rather large block of code at you here, but stick with me and we will move through it a piece at a time.

<script>

// require vue-resource...

new Vue({