Skip to content

Instantly share code, notes, and snippets.

@nmondollot
nmondollot / HeadingView.swift
Created December 16, 2020 21:14
iOS-14-style heading subview for MKUserLocation
//
// HeadingView.swift
//
// Created by Nicolas Mondollot on 10/12/2020.
// License: Attribution 4.0 International (CC BY 4.0)
//
import UIKit
import CoreLocation

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

class User < ActiveRecord::Base
MAILCHIMP_API_KEY = 'm23lm092m3'
has_many :orders
has_many :packages, through: :orders
before_save :assign_referral_code, on: :create
after_create :schedule_welcome_email
module Drivy::Pricing
+ class ChargesCalculator
+ attr_reader :rental_parameters, :rental_price, :cdw_price, :owner_charges, :driver_charges
+
+ delegate :drivy_comm, :assistance_fee, :insurance_fee, to: :owner_charges
+ delegate :rental_price, :cdw_price, to: :driver_charges
+
+ def initialize(rental_parameters, rental_price, cdw_enabled, car)
+ @rental_parameters = rental_parameters
+ @cdw_price = cdw_enabled ? CdwPrice.new(rental_parameters) : NullCdwPrice.new
  1. Quand on entre “Paris” dans le moteur de recherche de Drivy, on trouve plus de 1800 voitures. Dans quel ordre pensez-vous qu’il faut les trier, par défaut ?

  2. Comment amélioreriez-vous la conversion entre “je cherche une voiture sur Drivy” et “je réserve une voiture sur Drivy ?

  3. Actuellement, les propriétaires de voitures peuvent préciser s’ils acceptent de livrer leur voiture ailleurs que chez eux, à la demande du locataire. Ils peuvent préciser d’une part un rayon de livraison (ex : jusqu'à 3km de chez moi), d’autre part des points de livraison comme des gares ou aéroports. Ces informations ne sont pas encore exploitées dans le moteur de recherche, parce que c’est un chantier complexe que nous repoussons depuis longtemps. Quelle solution proposeriez-vous pour gérer les lieux de livraison des voitures ? Vous n’êtes pas obligé de partir de ce qui existe actuellement.

# Drivy backend test
## Context
Let's consider a problem we encountered at Drivy that can go pretty deep and can be quite complex : car availability.
A car owner can fill out a calendar to let other users know when his car is available :
![calendar](http://f.cl.ly/items/0y1X0G0M3y3F2d1k0t3p/Capture%20d%E2%80%99%C3%A9cran%202013-09-20%20%C3%A0%2012.00.08.png)
if ([status isEqualToString:@"1"]) {
self.availability = AvailabilityTypeOK;
} else if ([status isEqualToString:@"2"]){
self.availability = AvailabilityTypeOnRequest;
} else
self.availability = AvailabilityTypeNo;
-(NSInteger)length
{
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [calendar components:NSDayCalendarUnit
fromDate:self.dateFrom
toDate:self.dateTo
options:0];
double days = (double)components.day;