Skip to content

Instantly share code, notes, and snippets.

Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
@cal97g
cal97g / clean_code.md
Created October 23, 2019 11:09 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

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

@cal97g
cal97g / cmus_wallpaper.sh
Created February 25, 2019 18:41
Update your wallpaper with album art on new track
ORIGINAL_WALLPAPER="/home/callam/Pictures/papes/wallhaven-712747.jpg"
#This is the actual script, modify the options you want
if ! cmus-remote -C >/dev/null 2>&1 ; then
echo >&2 "cmus is not running"
exit 1
fi
echo "its running"
info=$(cmus-remote -Q)
@cal97g
cal97g / roman_numerals_to_arabic.py
Last active February 5, 2020 10:09
A 'broken' roman numeral converter
roman_to_arabic = {"I": 1,"V": 5,"X": 10,"L": 50,"C": 100,"D": 500,"M": 1000}
valid_subtractions = {"IV", "IX", "XL", "XC", "CD", "CM"}
def solution(s):
s = "".join(list(s.upper()))
for c in s:
if c not in roman_to_arabic.keys():
return 0
rta = roman_to_arabic
total = 0
skipnext = False
@cal97g
cal97g / python_binary_tree.py
Created May 2, 2018 17:40
An implementation of a basic Binary Tree in Python. I thought it was quite elegant.
class BinaryNode(object):
def __init__(self, name, left = None, right = None):
self.name = name
self.left = left
self.right = right
def set_root(self, obj):
self.name = obj
def insert_left(self, new_node):