Today I Learned

A list of thing they didn’t tell me in school.

GitHub

  • Create a special identity repository by naming a repository the same name as your username. Add a readme, and this will be displayed on your GitHub profile.

You found a secret! AndrewMJordan/AndrewMJordan is a ✨special ✨ repository that you can use to add a README.md to your GitHub profile. Make sure it’s public and initialize it with a README to get started.


Bash

  • Use cd - to return to the previous directory.
  • Use . as an alias for source.
  • Use CDPATH to change the search directories of cd
  • Use shell flags (-) to get information about the current shell
  • Use Bash prompt variables (PS1, PS2, PS3, PS4) to customize prompt strings
  • Extend an existing command by creating a ~/bin script where the script name begins with the command name (Example git-ac). Invoke the script like so:
$ git ac

Remember to make the script executable

  • On Windows Linux Subsystem, NuGet configuration gets written to ~/.nuget/NuGet/NuGet.config.
  • The sed command allows you to use other characters instead of / as the delimiter.
sed 's,/directory,/newDirectory,g'

Git

  • Use git status -s|--short to print a summary of changes.
  • Use git status -u|--untracked-files to print untracked files in untracked directories.
  • Use git checkout - to return to the previous branch.
  • Use git checkout @{-n} to return to $ n $ branches ago.

NET

  • Use JsonPropertyAttribute.NullValueHandling to skip null values from being serialized.
[JsonProperty("displayName", NullValueHandling = NullValueHandling.Ignore)]
public string DisplayName { get; set; }
  • Use Invoke to assign a delegate to Func.

Given the following delegate definition,

delegate int Calculator(int a, int b);

Assign the variable of type Calculator to Func<int, int, int> as follows:

int Add(int a, int b) => a + b;
Calculator calculator = Add;
Func<int, int, int> function = calculator.Invoke;

Unity

  • Use a csc.rsp file to suppress warnings.

Regular Expressions

Consider the following regular expression:

\(.+\)
  • Lazy Quantifier Matching (Shortest match)

  • Greedy Quantifier Matching (Longest match) This is the default behavior for quantifiers.


Markdown

  • Images can link to a URL:
[![Image][1]][2]

[1]: https://picsum.photos/200 "Image Title"
[2]: https://example.com "Link Title"

Here’s that markdown in action: Image

  • Use <kbd> tags to create keyboard expressions.

Miscellaneous

References


380 Words

2021-02-06 10:14 +0000