-
download_slides
: get the photos of the unit -
essence
: remove noise, while keeping only unit specific details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TestWithCassette | |
# cribbed from Rails and modified for VCR | |
# https://github.com/rails/rails/blob/b451de0d6de4df6bc66b274cec73b919f823d5ae/activesupport/lib/active_support/testing/declarative.rb#L9 | |
def test_with_cassette(name, vcr_options = {}, &block) | |
auto_cassette_name = name.gsub(/\s+/, '_') | |
test_name = "test_#{auto_cassette_name}".to_sym | |
if block_given? | |
group = vcr_options.delete(:group) | |
group_prefix = "#{group}/" if group.present? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'google/api_client' | |
require 'google/api_client/auth/file_storage' | |
require 'google/api_client/auth/installed_app' | |
module Google | |
class Drive | |
# https://github.com/google/google-api-ruby-client-samples/blob/master/drive/drive.rb | |
API_VERSION = 'v2'.freeze | |
CREDENTIAL_STORE_FILE = Rails.root.join('lib/google/credential_store.json').freeze |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rails _4.2.2_ new <app_name> --database=postgresql | |
create | |
create README.rdoc | |
create Rakefile | |
create config.ru | |
create .gitignore | |
create Gemfile | |
create app | |
create app/assets/javascripts/application.js | |
create app/assets/stylesheets/application.css |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard :minitest do | |
# with Minitest::Unit | |
watch(%r{^test/(.*)\/?test_(.*)\.rb$}) | |
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" } | |
watch(%r{^test/test_helper\.rb$}) { 'test' } | |
# with Minitest::Spec | |
# watch(%r{^spec/(.*)_spec\.rb$}) | |
# watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
# watch(%r{^spec/spec_helper\.rb$}) { 'spec' } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
# The priority is based upon order of creation: first created -> highest priority. | |
# See how all your routes lay out with "rake routes". | |
# You can have the root of your site routed with "root" | |
# root 'welcome#index' | |
# Example of regular route: | |
# get 'products/:id' => 'catalog#view' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# … | |
VCR.configure do |c| | |
c.hook_into :webmock | |
c.cassette_library_dir = 'spec/cassettes' | |
c.default_cassette_options = { :record => :new_episodes } | |
## Ignore some requests based on the hosts involved. | |
c.ignore_hosts 'localhost', '8.8.8.8', 'our.local.test.server.org' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rover | |
class InvalidDirection < StandardError | |
def message | |
'Vertigoooooo!' | |
end | |
end | |
VALID_DIRECTIONS = %i(north south east west).freeze | |
attr_accessor :ns_coordinates, :ew_coordinates, :direction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cache | |
attr_accessor :data | |
def initialize(data: {}) | |
@data = data | |
end | |
def get(key) | |
return if data.fetch(key, {}).fetch(:expires_at, nil) <= now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'minitest' | |
gem 'pry-byebug' |