Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 9, 2024 04:31
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

@soichisumi
soichisumi / firestore-listen-query.go
Created December 4, 2018 18:47
example of listening firestore realtime update in golang
package main
import (
"firebase.google.com/go"
"cloud.google.com/go/firestore"
"context"
"log"
"fmt"
)
@shmup
shmup / gist:6ed5af7c3f09f2e547974a5486b3fd24
Created January 16, 2018 23:56
Install Vim 8 with Python, Python 3, Ruby and Lua support on Ubuntu 16.04
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt-get install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim
cd ~
@rygorous
rygorous / iggy_focus.cpp
Created October 14, 2013 19:46
Iggy focus handling
enum FocusDir
{
DIR_W,
DIR_E,
DIR_N,
DIR_S
};
static FocusDir get_quadrant(float dx, float dy)
{
@chrismccord
chrismccord / dev.exs
Created May 8, 2024 20:06
Live Reload LiveView notify
config :wps, WPSWeb.Endpoint,
live_reload: [
notify: [
live_view: [
~r"lib/wps_web/core_components.ex$",
~r"lib/wps_web/(live|components)/.*(ex|heex)$"
]
],
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
@BretFisher
BretFisher / repair-windows-update.bat
Last active May 9, 2024 04:16
Reset Windows Update components RE: KB971058
@echo off
REM Automation of Steps to Reset Windows Updates
REM Tested on Server 2012 R2, likely works on everything Win7/2008R2 and up
REM by Bret Fisher bret@bretfisher.com
REM also find this info and more in a blog article at http://www.fishbrains.com/2015/01/29/untitled/
REM Origional Steps (identical to this): http://support.microsoft.com/kb/971058
REM This file Copyright MIT License
REM Stop Services
@kupietools
kupietools / Docker Desktop v 4.0.0 thru 4.22.1 direct download links
Last active May 9, 2024 04:12
List of Direct Download links for Docker Desktop from version 4.0.0 released 2021-08-31 thru 4.22.1 released 2023-08-24, as archived on archive.org
#!/bin/bash
# This script requires docker cli built from master since released version does not support riscv64 manifest annotation
# 1 可以使用binfmt跨平台构建,不需要在native上构建;go版本不低于1.16
# 确定 k8s 版本
# git reset --hard v1.21.1
# 确定配套的 pause 版本
# cat ./kubernetes/build/pause/Makefile | grep "TAG ="
#
# 2 k8s代码的修改:
@hlorand
hlorand / RaspberryPiVideoRecord.sh
Created June 24, 2017 18:37
Video recording and streaming script for Raspberry Pi + Pi Camera
#!/bin/bash
#
# Video recording script for Raspberry Pi. Set bitrate and recording time below
#
# To autostart this script after login, edit /etc/xdg/lxsession/LXDE-pi/autostart and add the following line BEFORE "@xsreensaver":
#
# sh ./RaspberryPiVideoRecord.sh
#
# To convert the output .h264 file to mp4:
#