- Do not add sensitive information about the user or the user's machine to the code or comments
- Break down large tasks into smaller steps. After completing each step, verify it works before continuing. Do not attempt to complete the entire task in one pass without intermediate validation.
- Prefer rg or fd command when grepping file content or searching for files
- Before running a package manager in the project, please detect which package manager is currently being used, like npm or pnpm
- You can run killport to kill the process that owns a port
- Follow the DRY coding rule
- Never use a variable or method that you are not sure exists
- Do not change the implementation to satisfy the tests
- Avoid deduplicating mock logic in tests; reimplement when needed to preserve clarity
- Consider the impact of changes across the module or file
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
-
Ctrl + F keys and a lot of other key combinations are hooked by MacOs. You're mostly don't use them, so just turn everything off in System Preferences -> Keyboard -> Shortcuts. If you have another software that handles your key combinations, like Keyboard Maestro, you should turn these actions/macros off, otherwise you won't get right hex sequence.
-
Enter command below in default MacOs Terminal. (Warning!: shortcuts can also be hooked by terminal emulators, like iTerm. To avoid it use default MacOs terminal. If you are on alacritty, you can enter
alacritty --print-events
and use poped up terminal).
xxd -psg
then type your key combination and hit enter. (Warning!: if you don't see any output for your combination, then read step 1 again)
https://www.nerdfonts.com/font-downloads
The following solution thanks to @hackerzgz & @snacky101 will install all nerd fonts;
brew tap homebrew/cask-fonts
brew search '/font-.*-nerd-font/' | awk '{ print $1 }' | xargs -I{} brew install --cask {} || true
There are two 'types' to be aware of with a quickfix window:
- entry: the actual line content (e.g.
:grep foo
will show a specific line that matched within a file). - file: the actual file itself (e.g. the path to the file that contained the match).
To replace content using vim (via the quickfix window) you need to choose whether you want to apply the change via the quickfix 'entry' or via the 'file' as a whole.
If you use cdo
, then your 'action' (i.e. how you're going to replace content) will be applied to every entry in the quickfix window.
If you use cfdo
, then your action will be applied to each file in the quickfix window.
#![warn(rust_2018_idioms)] | |
#[derive(Debug)] | |
pub struct StrSplit<'haystack, D> { | |
remainder: Option<&'haystack str>, | |
delimiter: D, | |
} | |
impl<'haystack, D> StrSplit<'haystack, D> { | |
pub fn new(haystack: &'haystack str, delimiter: D) -> Self { |
- macOS 10.15.5
- tmux 3.1b
macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.
Instead of tmux-256color
, use screen-256color
which comes with system. Place this command into ~/.tmux.conf
or ~/.config/tmux/tmux.conf
(for version 3.1 and later):
#![allow(dead_code)] | |
// Suppose we have a shared context for a lot of values, in this specific case, | |
// this is a shared lua_State for lots of values which live in the lua registry. | |
struct Lua; | |
// This is a representation of a value that lives in that shared context. In | |
// the real api, this is an enum that can represent any lua value, and most | |
// instances of it are handles to something that points to the lua registry, | |
// so logically it would hold a reference to the shared Lua state. |
This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).
Running this script should look the same in tmux as without.
curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
$ git clone [email protected]:xxxxx/xxxx.git my-awesome-proj | |
Cloning into 'my-awesome-proj'... | |
ssh: connect to host github.com port 22: Connection timed out | |
fatal: Could not read from remote repository. | |
$ # This should also timeout | |
$ ssh -T [email protected] | |
ssh: connect to host github.com port 22: Connection timed out | |
$ # but this might work |