A collection of random disconnected things that I learn on given days.
Learned about the "Dreadful Diamond on Derivation" problem...
Full credit to this stack overflow
Basically, you have an inheritance hierarchy that looks like
A
/ \
B C
\ /
D
The issue is that if we do A.D()
, we could be referring to A::B.D()
or A::C.D()
.
So you can do class A : public virtual B, public C{…)
to only inherit the actual methods from C
to solve this problem.
I set up neotest and nvim-dap and then removed them from my config. Turns out I prefer vscode
once I'm debugging/testing.
Some vscode
shortcuts:
control+1
focus the text editor groupcontrol+shift+e
toggle focus of the file tree and text editor groupIn information theory, linguistics, and computer science, the Levenshtein distance is a string metric for measuring the difference between two sequences. The Levenshtein distance between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other. It is named after Soviet mathematician Vladimir Levenshtein, who defined the metric in 1965.[1]
Learned sql, used https://sqlbolt.com. Very helpful tutorial.
Neovim has built in spell checking! No plugins needed
https://neovim.io/doc/user/spell.html
:setlocal spell spelllang=en_us
enable built in neovim spell checking
z=
- see spelling suggestions
You can use git mv <from> <to>
and git rm [-r] <thing>
to move and delete things with git
without consequences if you have things like submodules.
https://github.com/mikavilpas/yazi.nvim
Make dunst
go to the top right
origin = "top-right";
offset = "10x10";
Bash variable parameter extraction + glob stuff
${VARIABLE}%ff
removes the first occurrence of ff
from the back of VARIABLE
${VARIABLE}#ff
removes the first occurrence of ff
from the front of VARIABLE
${variable//pattern/replacement}
is a form of parameter expansion that replaces all occurrences of pattern with replacement in the value of variableOpen source alternative to zoom https://p2p.mirotalk.com/
In bash
you can use **
to get a list of files in the current directory. You can even pattern match with like **.nix
So, like
1for file in **; do 2 echo $file 3done
And file
is the relative path of the file from where you run the command.
css
has a not
function to target things that are not the thing. So like, p:not(.foobar #barbar)
will target everything that is not of class foobar
and with id barbar
.
Capital W
and capital B
take you forward and backward a word in vim without regard for periods
Apparently python
has a Windows specific error message
You can easily get example videos in various formats at https://sample-videos.com/
gm
goes to the center of the current line in vim
Powershell is open source. You can use Powershell as your default Linux shell. Who knew.
Also, Windows has a cool app called "Sandbox," which you can create xml
config files to template, that are basically Windows virtual machines without bloat (not even the microsoft store). They work really well, I think they should be a distribution of Windows itself.
https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-overview
false
the iteration ends. If you return 'skip' then it skips the iteration right away (kinda like continue
if it were a loop or walker iterator).Used this to create this script to yoink a specific section from a markdown string (for example, I want to get the # Description section's paragraphs only)
1export function getContentOfSection( 2 markdown: string, 3 header: string, 4 depth: number = 1 5) { 6 const ast = unified() 7 .use(remarkParse) 8 .parse(markdown); 9 10 const output: string[] = []; 11 let inHeadersSection = false; 12 let nextIsWantedText = false; 13 visit(ast, node => { 14 if ( 15 node.type === "heading" && 16 node.depth === depth && 17 node.children.length > 0 && 18 node.children[0].type === "text" && 19 node.children[0].value === header 20 ) 21 inHeadersSection = true; 22 if (inHeadersSection) { 23 if (nextIsWantedText) { 24 if (node.type === "text") output.push(node.value); 25 else if (node.type !== "paragraph") return false; 26 } 27 if (node.type === "paragraph") nextIsWantedText = true; 28 } 29 }); 30 return output.join("\n"); 31}