Skip to content

Instantly share code, notes, and snippets.

View MichaelrMentele's full-sized avatar
👨‍💻

Michael Mentele MichaelrMentele

👨‍💻
View GitHub Profile

I was wrapping up 310 (Robust Production Quality Applications with Rails) after 3 busy weeks and 168 hours of work. I felt very comfortable building modest applications end-to-end and integrating with third party API's like Stripe and Twilio.

I was considering the review project I was going to build (#spaced repetition anyone?) that would encapsulate the course. As I'm reaching this point Gavin McGimpsey (we know him, we love him) posted about Ruby Rampage--a 48 hour hackathon.

Serendipity! It's always nice to outsource motivation for mundane work so you can save a portion of your willpower (AKA glucose/ketones) to stay mentally 'frosty' (we are all cognitive misers, so sayeth Nobel Psychologist Daniel Kahneman).

Plus, it was a chance to compete--iron sharpens iron and all that.

The Verdict

So how did it go? Well, I went into the weekend confident, slipped on the starting line, and failed completely. It was terrific.

@MichaelrMentele
MichaelrMentele / waiting_time.rb
Created April 19, 2017 23:32
Efficient waiting time computation for tickets challenge
def waitingTime(tickets, p)
# if you only want 1 ticket just count number of people in front,
return p + 1 if tickets[p] == 1
wait = 0
multiplier = 1
for i in 0...tickets.length do
next if i == p
require 'digest'
class Node
attr_accessor :datum, :data, :children, :parent
def initialize(datum, children: nil)
self.parent = nil
self.datum = datum
self.children = []
end

Debugging

access the global store from the console with no code changes: $r.store.getState()

# returns bool if can be solved
# solving a sudoku board...
# I could try all permutations and check the board
# or I could actually fill in the board... that seems tough
# but if I try every solution...
# when the following are valid for all:
# rows
# cols
# sections

You will have an hour to work on your own. Feel free to ask any questions or clarifications you might have.

The goal for this practical is to implement a search bar with suggestion functionality. Don't worry too much about completing it -- an hour isn't that much time! -- we are more interested in progress and understanding where you are.

The view will do two things:

  1. display a vehicle inventory list
  2. let's you search inventory for a vehicle with suggestions

A few notes:

We are interested in building a system to manage a customer relationship lifecycle from lead (saw vehicle and inquired) to return customer.

Background

Independent dealerships publish inventory to an arbitrary number of third party websites as well as their own. This is a key way for them to advertise and source buyers.

When a someone indicates interest in a vehicle that is a lead the dealership needs to be notified about and take action with the goal of bringing them onsite to sell a car.

In addition, beyond the short sales cycle there is also the long term sales cycle of maintaining relationships with long term customers. Some dealers might not be interested in this and others may want to create simple rules about when to reach out to customers. This can take the form of an alert.

Requirements

You'll have an hour to work on your own feel free to ask questions or look things up.

The goal is to provide an API to manage tasks.

Requirements

The api should be able to return the following

  • overdue tasks
  • completed tasks
  • incomplete tasks
  • change the dueDate of tasks
// this works
import CommentForm from './CommentForm'
export const generated = () => {
mockGraphQLMutation('CreateCommentMutation', (variables, { ctx }) => {
const id = parseInt(Math.random() * 1000)
ctx.delay(1000)
return {
src/services/floorPlans/floorPlans.ts:27:9 - error TS2322: Type 'CurtailmentCreateNestedManyWithoutFloorPlanInput' is not assignable to type '(Without<CurtailmentCreateWithoutFloorPlanInput, CurtailmentUncheckedCreateWithoutFloorPlanInput> & CurtailmentUncheckedCreateWithoutFloorPlanInput) | ... 6 more ... | (Without<...> & CurtailmentCreateWithoutFloorPlanInput[])'.
27 create: input.curtailments,
~~~~~~
../node_modules/.prisma/client/index.d.ts:10597:5
10597 create?: XOR<Enumerable<CurtailmentCreateWithoutFloorPlanInput>, Enumerable<CurtailmentUncheckedCreateWithoutFloorPlanInput>>
~~~~~~
The expected type comes from property 'create' which is declared here on type 'CurtailmentUncheckedCreateNestedManyWithoutFloorPlanInput | CurtailmentCreateNestedManyWithoutFloorPlanInput'