Skip to content

Instantly share code, notes, and snippets.

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@martyphee
martyphee / generate-pushid.js
Created September 17, 2024 12:36 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
# unset GITHUB_TOKEN from gh's process environment and run gh command.
# see https://stackoverflow.com/a/41749660 & https://github.com/cli/cli/issues/3799 for more.
alias gh="env -u GITHUB_TOKEN gh $1"
@martyphee
martyphee / remerge.py
Created November 29, 2023 09:08 — forked from mahmoud/remerge.py
Recursively merging dictionaries with boltons.iterutils.remap. Useful for @hynek's configs. https://twitter.com/hynek/status/696720593002041345
"""
This is an extension of the technique first detailed here:
http://sedimental.org/remap.html#add_common_keys
In short, it calls remap on each container, back to front, using the accumulating
previous values as the default for the current iteration.
"""
@martyphee
martyphee / Banana.scala
Created August 12, 2021 11:25
Sangria Banana example
import com.typesafe.scalalogging.LazyLogging
import sangria.execution.Executor
import sangria.macros._
import sangria.marshalling.sprayJson._
import sangria.schema.{Argument, DirectiveLocation => DL, _}
import spray.json._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.io.StdIn
import scala.util.{Failure, Success}
syntax = "proto3";
package tutorial;
message BillingAddress {
string address1 = 1;
string address2 = 2;
}
message Person {
@martyphee
martyphee / zio-layers.scala
Created March 2, 2020 08:10 — forked from strobe/zio-layers.scala
DI with zio ZLayer
// val ZIOVersion = "1.0.0-RC17+319-8917936d-SNAPSHOT"
// resolvers += Resolver.sonatypeRepo("snapshots")
//
// libraryDependencies ++= Seq(
// // zio
// "dev.zio" %% "zio" % ZIOVersion,
// "dev.zio" %% "zio-streams" % ZIOVersion,
// )
package com.martyphee.sqs
import akka.NotUsed
import akka.stream.ActorAttributes.supervisionStrategy
import akka.stream.alpakka.sqs.scaladsl.{SqsAckSink, SqsSource}
import akka.stream.alpakka.sqs.{MessageAction, SqsAckSettings, SqsSourceSettings}
import akka.stream.scaladsl.{Flow, Keep, RestartSink, RestartSource, Sink, Source}
import akka.stream.{ActorMaterializer, KillSwitches, Supervision, UniqueKillSwitch}
import com.martyphee.repo.PlayRepo
import com.typesafe.scalalogging.LazyLogging
We never want to abruptly restart production.
The Heroku deploy hook is setup to do a rolling restart of the dynos: it will gracefully replace the old generation with the new one, and will only stop dynos after they're done serving the current request and if there are new ones ready to take their place.
Sometimes we need to restart production manually. The manual command, however, will kill and restart all the dynos at the same time.
Use this shell script to automate a gradual restart of the production dynos.
```shell
#!/usr/bin/env sh
@martyphee
martyphee / deliveroo-en.js
Created February 18, 2016 08:13
ReactOnRails: Adding a before_render and after_render hooks to server rendering.
jed = new Jed({
"domain": "orderwebjsx",
"locale_data": {
"orderwebjsx": {
"": {
"domain": "orderwebjsx",
"plural_forms": "nplurals=2; plural=(n != 1);",
"lang": "en"
},
"Martin John Phee": [