- Adjust settings
- disable scroll direction: natural
- allow watch to unlock mac
- require password 5 seconds after screen saver
- clear apps from dock and move dock to left
- install homebrew
defmodule MontyHall do | |
defstruct [:doors, :hidden] | |
def play(door_count) do | |
game = new(door_count) | |
pick = :crypto.rand_uniform(1, door_count + 1) | |
with_revealed_doors = first_move(game, pick) | |
{action, new_pick} = | |
case Enum.random([:switch, :dont]) do |
# Setup build image | |
FROM elixir:1.10.4-alpine AS builder | |
# Install build dependencies | |
RUN apk update && \ | |
apk add --no-cache \ | |
bash \ | |
build-base \ | |
curl \ | |
git \ |
defmodule Flatten do | |
@spec flatten(List.t()) :: List.t() | |
def flatten([]), do: [] | |
def flatten([head | tail]) when is_list(head), do: flatten(head) ++ flatten(tail) | |
def flatten([head | tail]), do: [head | flatten(tail)] | |
def flatten(_), do: raise("argument must be a list") | |
end | |
ExUnit.start() |
def flatten(arr, output = []) | |
raise "Input must be array. Usage: flatten(arr)" unless arr.class == Array | |
arr.each do |el| | |
if el.class == Array | |
flatten(el, output) | |
else | |
output << el | |
end | |
end | |
output |
I hereby claim:
To claim this, I am signing this object:
require 'pry' | |
# Extend Integers for prime number methods | |
class Integer < Numeric | |
def prime? | |
2.upto((self**0.5).to_i) { |n| return false if self % n == 0 } | |
true | |
end | |
def next_prime | |
next_prime = self + 1 |