Skip to content

Instantly share code, notes, and snippets.

View Pharap's full-sized avatar
🇺🇦
Путин - клептократический тиран

Pharap Pharap

🇺🇦
Путин - клептократический тиран
  • 19:25 (UTC +01:00)
View GitHub Profile
@Pharap
Pharap / C++ Compilation.md
Last active June 13, 2021 17:32
A rough description of C++ compilation. Good enough for an introduction, but not particularly technical.

The C++ build process is roughly as thus:

  1. All .cpp (and possibly .c) files are compiled:
    1. First the preprocessor processes the file, it (as required):
      • Parses and processes all #defined macros, storing their definitions in a symbol table (a string to string dictionary).
      • Parses and processes all #if, #elif and #endif macros, thus performing conditional compilation.
      • Parses and processes all #included header (.h) files, which includes inserting the contents of the header file into the point at which it was #included (or performs a process that achieves the equivalent effect).
      • Parses and processes all #pragmas, implementing their compiler-specific behaviour.
        • Note that the most common and widely supported #pragma is #pragma once, which acts as an alternative to include guards.
@Pharap
Pharap / WindowsKeyboardCombos.md
Last active June 13, 2021 17:32
Windows Keyboard Combos
@Pharap
Pharap / Programming Sins.md
Created October 11, 2019 02:06
A list of so-called 'programming sins'

Programming Sins

  • Magic numbers
    • Constants with a specific meaning should be clearly named
    • Possible exceptions include:
      • 0, 1 and 2 where usage is unambiguous
      • arguably the shift and mask values when doing bitshifting and masking
  • Single-letter variables names
    • With the possible exceptions of:
  • x and y for coordinates
@Pharap
Pharap / FunniestBugs.md
Last active June 13, 2021 17:53
A collection of amusing software bugs

Funniest Bugs

Video Games

Bethesda

Morrowind

  • Ordinarily if you are kicked out of the Mages Guild you must talk to the Arch-Mage to be reinstated. Later in the quest line you can become the Arch-Mage by killing the previous Arch-Mage. If you are then expelled from the guild after having become the Arch-Mage by killing the former Arch-Mage then you can no longer be reinstated into the guild because there will no longer be an Arch-Mage to talk to.
@EricWF
EricWF / constinit.md
Last active July 16, 2020 09:07
A Proposal to add [[constinit]] to C++
Document Number: P1143r3
Date: 2019-06-18
Project: Programming Language C++, Evolution
Revises: P1143r2
Reply to: eric@efcs.ca

Adding the constinit keyword

#BAD!

$('.link').on('click', _ => $('.link').attr('href', $('.link').attr('href').replace(/#.+/,'')));

#GOOD!

const link = $('.link');

link.on('click', _ => link.attr('href', link.attr('href').replace(/#.+/, ''));

The Close Voter's Guide To Gimme Teh Codez:

How To Moderate How-To Questions

They are not inherently off-topic

It is a common misconception that questions "requesting code" are off-topic. Usually these people express their opinion with the following line:

We are not a code writing service

Yes we are. We write code. We do it all the time. People ask questions, we write code. This is not the only thing we do, but we do write code, and we are a service. So yes, we are a code writing service. Sorry to burst your bubble.

@taoyuan
taoyuan / npm-using-https-for-git.sh
Last active April 27, 2024 01:22
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@dreftymac
dreftymac / .gitattributes
Created October 31, 2015 14:34
Sample Git Attributes File
# Encrypt the repository
# Remove/modify this line if the repository is meant to be open-source
*.* filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.css text
*.js text
*.htm text
@haasn
haasn / about:config.md
Last active April 2, 2024 18:46
Firefox bullshit removal via about:config

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.