User stories are a brief description of the tasks, from the user's point of view. They add value to the business.
- As a 'user'
- I want to 'do something'
| #!/bin/bash | |
| echo -n "GitHub User: " | |
| read USER | |
| echo -n "GitHub Token (2FA): " | |
| read -s PASS | |
| echo "" | |
| echo -n "GitHub Repo (e.g. foo/bar): " |
| These aren't designed to be difficult, they are designed to showcase coding style. Please take the time you need to complete your answers to a quality that you would be comfortable submitting for a code review (i.e. production ready). Feel free to email me if you have any questions. | |
| Question 1: | |
| With the array (1,2,3,4,5,6), write a recursive function that outputs: | |
| <1> | |
| <2> | |
| <3> | |
| <4> |
| These aren't designed to be difficult, they are designed to showcase coding style. Please take the time you need to complete your answers to a quality that you would be comfortable submitting for a code review (i.e. production ready). Feel free to email me if you have any questions. | |
| Question 1: | |
| With the array (1,2,3,4,5,6), write a recursive function that outputs: | |
| <1> | |
| <2> | |
| <3> | |
| <4> |
| # OSX for Hackers (Mavericks/Yosemite) | |
| # | |
| # Source: https://gist.github.com/brandonb927/3195465 | |
| #!/bin/sh | |
| # Some things taken from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # Ask for the administrator password upfront |
| module Cancelerizer | |
| def cancel arg | |
| Sidekiq::ScheduledSet.new.each do |job| | |
| (klass, method, args) = YAML.load job.args.first | |
| if self == klass and args.first == arg | |
| job.delete | |
| end | |
| end | |
| end | |
| end |
| require 'perftools' | |
| TIMES = 100_000 | |
| Benchmark.bm do |bm| | |
| bm.report 'FactoryGirl.build' do | |
| PerfTools::CpuProfiler.start("factorygirl") do | |
| TIMES.times { FactoryGirl.build :loans_search_form } | |
| end | |
| end |
| # Support for Rspec / Capybara subdomain integration testing | |
| # Make sure this file is required by spec_helper.rb | |
| # | |
| # Sample subdomain test: | |
| # it "should test subdomain" do | |
| # switch_to_subdomain("mysubdomain") | |
| # visit root_path | |
| # end | |
| DEFAULT_HOST = "lvh.me" |
| # Small method to re-sort a result from ActiveRecord by a pre-ordered list of id's. | |
| # Method is of great use e.g. when using Redis to store sorted sets and needing to | |
| # retrieve those objects, preserving the order. | |
| # The method makes one query to retrieve the records, then uses index_by to create | |
| # a hash of the result for fast resorting. | |
| # Future enhancements should allow for extra params to be passed in, such as a list | |
| # of other models to include and prevent n+1 queries, possibly the ability to pass | |
| # in a model method for the query to use in place of 'where' if required, and possibly | |
| # the ability to add extra ActiveRecord parameters to the query. |
| #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) |