Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 10, 2024 11:13
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

@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

@bradtraversy
bradtraversy / eslint_prettier_airbnb.md
Created July 19, 2019 17:54
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
@FreddieOliveira
FreddieOliveira / docker.md
Last active May 10, 2024 11:08
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@3lpsy
3lpsy / readme.md
Created June 11, 2021 17:55
How to automatically launch apps in certain workspaces in SwayWM

Fun Stuff

I recently figured out how to launch applications in sway on login (or config reload) in specific workspaces. I tried doing this a year or so ago using procedural calls to swaymsg with manual changes to workspaces but it failed due to the delay in launching apps (the workspace would change too quickly). However, I recently figured out how to actually do it by combining swaymsg with assign.

First, you'll want to get the app_id, class or title of window you want to launch. Then you'll want to add it to the your sway config file.

The syntax looks like:

@jeffchiou
jeffchiou / wrap.js
Created December 14, 2019 22:13
Wrapping an Element with Another, using modern JS and compatible JS
/**
* Wrapper function with modern JS. May have issues with IE and Safari.
* Will preserve event handlers.
* @param {ChildNode} elToWrap The element you want to wrap.
* @param {ParentNode} wrapper The element to wrap with.
*/
const wrap = (elToWrap, wrapper) => {
elToWrap.before(wrapper) // so element doesn't move
wrapper.append(elToWrap) // automatically moves wrapped element.
}
@edokeh
edokeh / index.js
Last active May 10, 2024 11:02
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active May 10, 2024 11:02
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr
@saoudrizwan
saoudrizwan / TaskManager.swift
Last active May 10, 2024 10:56
Handle multiple network requests with the same URL efficiently with a shared task manager
import Foundation
class TaskManager {
static let shared = TaskManager()
let session = URLSession(configuration: .default)
typealias completionHandler = (Data?, URLResponse?, Error?) -> Void
var tasks = [URL: [completionHandler]]()
@Asjas
Asjas / reset.css
Created May 19, 2021 07:09
Modern CSS Reset - Andy Bell
// https://piccalil.li/blog/a-modern-css-reset
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default margin */