Skip to content

Instantly share code, notes, and snippets.

View Mwapsam's full-sized avatar
🎯
Focusing

Samuel Chimfwembe Mwapsam

🎯
Focusing
View GitHub Profile
# Systems Architecture Expert - Black Box Design Specialist
You are a senior systems architect specializing in modular, maintainable software design. Your expertise comes from Eskil Steenberg's principles for building large-scale systems that last decades.
## Core Philosophy
**"It's faster to write five lines of code today than to write one line today and then have to edit it in the future."**
Your goal is to create software that:
The Three Pillars of Writing Good Code
When you're writing code, it's like building a strong foundation for a house. Just as a house needs a solid base, your code needs to have certain key qualities to make it reliable and efficient. These qualities are like pillars that support your code. Let's explore these three pillars of good code and also delve into the skills that interviewers seek in a proficient coder.
Pillar 1: Readable Code
Imagine reading a book with messy handwriting and confusing sentences. It wouldn't be enjoyable, right? The same goes for code. Readable code is like clear writing. It's easy to understand and follow. When your code is readable, anyone can look at it and quickly figure out what's happening. This is crucial because other programmers might need to work with your code, or you might revisit your own code after a while.
Pillar 2: Time Complexity
@Mwapsam
Mwapsam / Create the Object Roles
Created July 13, 2023 14:36
Create the Object Roles
module FriendApprover
def approve(friend_request)
friend_request.approved = true
friend_request.save
increment_friends
notify_new_buddy(friend_request.user_id)
end
def increment_friends
friend_count += 1
@Mwapsam
Mwapsam / start_dev_server.sh
Created May 17, 2023 06:18
start_dev_server.sh
echo "Running migrations"
python manage.py migrate
echo "Starting development server"
python manage.py runserver 0.0.0.0:8000
@Mwapsam
Mwapsam / Dockerfile
Last active May 17, 2023 06:17
Dockerfile
FROM python:3.9.12
WORKDIR /app
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
# pip:
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on
@Mwapsam
Mwapsam / docker-compose.dev.yml
Created May 17, 2023 06:15
docker-compose.dev.yml
version: "3"
services:
web:
build: .
command: sh start_dev_server.sh
volumes:
- .:/app
environment:
- DEBUG=1
env_file:
var RecentCounter = function() {
this.Q = []
};
/**
* @param {number} t
* @return {number}
*/
RecentCounter.prototype.ping = function(t) {
this.Q.push(t);
/**
* @param {number[]} nums
* @return {void} Do not return anything, modify nums in-place instead.
*/
var sortColors = function (nums) {
const countConfig = { 0: 0, 1: 0, 2: 0 };
for (const iterator of nums) {
countConfig[iterator] += 1;
}
/**
* @param {string} s
* @param {number[]} indices
* @return {string}
*/
const emptyy = [];
var restoreString = function (s, indices) {
emptyy.length = 0;
const str = [...s];
@Mwapsam
Mwapsam / Interview Cheat Sheet
Created July 20, 2022 11:39
Interview Cheat Sheet - From Andrei Neagoie's Master The Coding Interview: Data Structures + Algorithms
The 3 pillars of good code:
1. Readable
2. Time Complexity
3. Space Complexity
What skills interviewer is looking for:
Analytic Skills - How can you think through problems and analyze things?
Coding Skills - Do you code well, by writing clean, simple, organized, readable code?
Technical knowledge - Do you know the fundamentals of the job you're applying for?
Communication skills: Does your personality match the companies’ culture?