Skip to content

Instantly share code, notes, and snippets.

@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

Priority Queues
═══════════════
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INSERT DEL-MIN MIN DEC-KEY DELETE MERGE
binary log n log n 1 log n log n n
binomial 1 log n 1 log n log n log n
Fibonacci 1 log n† 1 1† log n† log n
Pairing 1† log n† 1† 1† log n† 1†
Brodal-Okasaki 1 log n 1 1 log n 1
@josevalim
josevalim / watcher.sh
Last active February 28, 2024 07:42
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | mix test --stale --listen-on-stdin
require 'rspec'
require 'rspec/autorun'
require 'nokogiri'
class SomeClass
def example(doc); end
end
# Warning: running this _will_ freeze your computer or at the very least make it
# very slow, consume a lot of CPU and burn your lap (in case you're using a
@mislav
mislav / Gemfile
Last active August 29, 2015 14:18 — forked from janko/benchmark.rb
source "https://rubygems.org"
gem "minitest"
gem "rspec"
@janko
janko / benchmark.rb
Last active August 29, 2015 14:18
Minitest loads *slower* than RSpec?
require "benchmark/ips"
File.write "minitest_test.rb", <<-EOS
require "minitest/autorun"
require "minitest/pride"
class MintestTest < Minitest::Test
def test_foo
assert true
end
@pnc
pnc / observer.md
Last active September 9, 2023 23:32
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@tiegz
tiegz / object_profiler.rb
Last active August 29, 2015 14:03
Object Profiler for ruby 2.1.0+
module ObjectSpace
def self.profile(&blk)
require 'objspace'
enable_gc = GC.disable
ObjectSpace.trace_object_allocations(&blk)
objs = Hash.new(0)
ObjectSpace.each_object { |o|
if (file = ObjectSpace.allocation_sourcefile(o)) && (line = ObjectSpace.allocation_sourceline(o))
objs["#{file}:#{line}:#{o.class.name}"] += 1
This tool is used to compare microbenchmarks across two versions of code. It's
paranoid about nulling out timing error, so the numbers should be meaningful.
It runs the benchmarks many times, scaling the iterations up if the benchmark
is extremely short, and it nulls out its own timing overhead while doing so. It
reports results graphically with a text interface in the terminal.
You first run it with --record, which generates a JSON dotfile with runtimes
for each of your benchmarks. Then you change the code and run again with
--compare, which re-runs and generates comparison plots between your recorded
and current times. In the example output, I did a --record on the master
@ordinaryzelig
ordinaryzelig / .ruby-version
Last active August 29, 2015 14:01
Test cases for thread-safety in mocking libraries (http://redningja.com/dev/parallel-tests-with-single-database/)
ruby-2.0.0-p353