Skip to content

Instantly share code, notes, and snippets.

View dc0d's full-sized avatar
💭
Some Sketches ¯\_(ツ)_/¯

Kaveh Shahbazian dc0d

💭
Some Sketches ¯\_(ツ)_/¯
View GitHub Profile
@dc0d
dc0d / placeholder.md
Created October 23, 2023 11:23
placeholder

🗓️

@dc0d
dc0d / git-worktree.md
Created March 14, 2023 08:11
git worktree
workspace <- just a plain directory
├── main  <- main checkout
├── branch1
├── branch2
└── branch3

list of worktrees

@dc0d
dc0d / Crap-Code-Properly.md
Last active March 15, 2023 20:13
Crap Code Properly

Crap Code Properly

This post contains some personal experiences formed while working on some personal projects. Do not use any of these in your work or your teams ¯\_(ツ)_/¯.

Directory Layout

Use this directory layout:

.
├── core
@dc0d
dc0d / a_simplified_view_of_a_gen_server.md
Created November 2, 2022 21:16
A Simplified View of a GenServer

A Simplified View of a GenServer

The most famous Actor Model implementation is Erlang Machine, also called BEAM. And OTP is one of the most exciting parts of BEAM. The GenServer is a very flexible and versatile abstraction provided by BEAM. Any server whose design is based on the server/client pattern can be implemented as a GenServer.

A GenServer consists of a mailbox, an event-loop, and a set of callbacks. The runtime concerns are abstracted away. We only need to focus on our solution. Then we pass that to the runtime as a set of callbacks. We are not involved with any concurrency-related concerns!

It sounds stupid to get excited over this. Nevertheless, giant industries rely on this abstraction - and BEAM because it is one of the most interesting cases for the Separation of Concerns principle. It’s like: the GenServer actor (it’s an actor) tells us, “I’ll take care of the runtime concerns (the concurrency stuff), and you take care of the business logic.” And yes, one could argue it is also a case of I

@dc0d
dc0d / 2021-w47-code-is-a-liability-and-must-be-disposable.md
Last active December 1, 2021 06:15
Code is a liability and must be disposable #blog

code is a liability and must be disposable

All the reduction in revenue comes from the code. All the lost opportunities and overdue time-to-market come from the code. The code causes long lead times. All the bugs come from the code. And for developers all the beautiful weekends, that you could be spent with your kids and your family, but weren't so, come from the code.

Code is a liability, not an asset. The functionality of it could be an asset, assuming you're building something that someone is willing to pay for it. If it was possible to have the functionality, without the code, that would be Nirvana! Unfortunately, that's not possible.

We know that if we want the functionality, we can not avoid the code. Yet, maybe we can try to make the code disposable. The presence of disposable code is less intrusive and you can get on more easily with your life.

There are two aspects to the code production process. First, it is possible to focus on the process of code generation, which nobody likes to talk about b

@dc0d
dc0d / 2021-w44-meditating-on-oop.md
Last active November 5, 2021 20:07
meditating on oop #blog

This talk by Sandi Metz, on OOP, is very interesting. I enjoy watching it from time to time.

IMAGE ALT TEXT HERE
@dc0d
dc0d / 2021-w44-using-github-gists-for-blogging.md
Last active November 5, 2021 00:49
using github gists for blogging #blog

The idea of using gists for blogging sounds interesting. They can be searched like this for a user's blog gists. #blog should be appended to the title of the gist for it to show up in the search result.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dc0d
dc0d / persian_calendar.ex
Created October 31, 2018 12:07
Persian Calendar Functions for Elixir
defmodule PersianCalendar do
@moduledoc """
for converting persian calendar to/from gregorian calendar
"""
@breaks [
-61,
9,
38,
199,