- inaturalist app classify trees plants animals
- wildbook
- http://officefloor.net/DDDPerth2019.pdf
- officefloor/tutorials
- love the intro and history lesson!
| require 'benchmark/ips' | |
| Benchmark.ips do |bm| | |
| MAX_LENGTH = 280 | |
| long_string = 'YOLO: the return of the comeback' | |
| bm.report('delete_prefix') do | |
| long_string.delete_prefix('YOLO: ') | |
| end |
| class User < ActiveRecord::Base | |
| def coolifier | |
| username = "#{username}...the Coolest!" | |
| end | |
| def make_cool | |
| cool = true | |
| end | |
| end |
| subject(:valid_things_ids) { described_class.valid_things_ids(group) } | |
| let(:group) { 'blurb' } | |
| let!(:random_thing) { FactoryGirl.create(:something, group: 'blurb', id: 111) } | |
| let!(:another_thing) { FactoryGirl.create(:something, group: 'blurb', id: 222) } | |
| let!(:not_included) { FactoryGirl.create(:something, group: 'shrug', id: 333) } | |
| it do | |
| expect(valid_things_ids).to include 111 |
| subject(:valid_things_ids) { described_class.valid_things_ids(group) } | |
| let(:group) { 'example' } | |
| before do | |
| described_class::VALID_THINGS.each do |thing| | |
| FactoryGirl.create(:something, group: 'example', name: thing) | |
| end | |
| end |
| describe 'when receiving the hero details' do | |
| it 'should have the top level keys as methods' do | |
| top_level_keys = %w{id name gender level paragonLevel hardcore skills items followers stats kills progress dead last-updated} | |
| top_level_keys.each do |tl_key| | |
| @my_hero.send(tl_key).must_equal @my_hero.response[tl_key.camelize(:lower)] | |
| end | |
| end | |
| end |
| # frozen_string_literal: true | |
| module Vehicle | |
| class Crasher | |
| def initialize(vehicle) | |
| @vehicle = vehicle | |
| end | |
| def run | |
| return if vehicle.parked? || vehicle.stalled? |
| 'use strict' | |
| const config = require('config') | |
| module.exports.myUrl = (uploader, method) => { | |
| return `http://example.com/${uploader}/${method}` | |
| } |
| RSpec.describe ApiCaller do | |
| describe '#run' do | |
| let(:route_builder_mock) { instance_double(RouteBuilder } | |
| before do | |
| allow(RouteBuilder).to receive(:new).and_return(route_builder_mock) | |
| end | |
| context 'route builder threw an error' do | |
| before do |
| require 'rest-client' | |
| class ApiCaller | |
| def run | |
| url = RouteBuilder.new(some_arg: 'hello').run | |
| RestClient.post(url, params, headers) | |
| end | |
| end |