Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 1, 2024 07:50
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

@eramdam
eramdam / .skhdrc
Created November 17, 2020 15:38
yabai/skhd config
#!/usr/bin/env sh
:: default : yabai -m config active_window_opacity 1; yabai -m config normal_window_opacity 1;
# Focus
shift + alt - home : yabai -m window --focus north
shift + alt - j : yabai -m window --focus north
shift + alt - end : yabai -m window --focus south
shift + alt - k : yabai -m window --focus south
shift + alt - delete : yabai -m window --focus west
@MeLlamoPablo
MeLlamoPablo / nvmlink
Created February 1, 2017 11:34
Creates a symlink to /usr/bin/node after using nvm
@siayi
siayi / Regex-NIK-KTP.md
Last active May 1, 2024 07:44
Penjelasan Regex Nomor NIK KTP

Regex KTP / NIK versi 1 (sederhana):

^\\d{16}$

^ : penanda awal kata

\d{16} : harus matching angka (digit / d) sebanyak 16 buah.

$ : penanda akhir kata

@yasirkula
yasirkula / ScrollViewFocusFunctions.cs
Created October 23, 2021 10:09
Focus/center Scroll View to the specified point/item in Unity
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public static class ScrollViewFocusFunctions
{
public static Vector2 CalculateFocusedScrollPosition( this ScrollRect scrollView, Vector2 focusPoint )
{
Vector2 contentSize = scrollView.content.rect.size;
Vector2 viewportSize = ( (RectTransform) scrollView.content.parent ).rect.size;
@giventofly
giventofly / regex-cyrillic-2-latin.php
Last active May 1, 2024 07:37
regex convert russian (cyrillic) to latin
<?php
//https://stackoverflow.com/a/6837426/1911609
function strtolatin($string){
if (strpos($string = htmlentities($string, ENT_QUOTES, 'UTF-8'), '&') !== false){
$string = html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i', '$1', $string), ENT_QUOTES, 'UTF-8');
}
return $string;
}
@qoomon
qoomon / conventional_commit_messages.md
Last active May 1, 2024 07:34
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@elktros
elktros / ISD1820_Voice_Recorder_Arduino.ino
Created December 26, 2018 10:18
Code for Interfacing ISD1820 Voice Recorder Module with Arduino.
int rec=2;
int play=3;
int sensor=4;
int led=13;
void setup()
{
pinMode(rec,OUTPUT);
pinMode(play,OUTPUT);
pinMode(led,OUTPUT);