Skip to content

Instantly share code, notes, and snippets.

View mlazowik's full-sized avatar

Michał Łazowik mlazowik

View GitHub Profile
@mlazowik
mlazowik / tips.md
Last active May 8, 2022 14:03
Programming efficiency tips

Working with errors

First, isolate the actual error message. Sometimes it can be buried in hundreds of lines of warnings and unrelated output (c++ templates are notorious for that, things are getting better with colored higlighted output tho, clang usually gives better output than gcc).

Sometimes the best way is to literally search for the word “error” in the output/terminal.

If you don’t (almost) almost immediately know what’s wrong it almost always make sense to copy the error into Google. After copying try to figure out which parts are specific to your code (like function/variable names, specific memory addresses etc.) and remove them before hitting search. This will make results more focused as Google will not try and include your specifics.

Google search operators

Learn google search operators if you don’t know them. Most useful ones are:

  • quotes to search for exact phrases (normally google includes synonyms, different word order, disjoin words etc.)
INFO global: Vagrant version: 2.2.3
INFO global: Ruby version: 2.4.4
INFO global: RubyGems version: 2.6.14.1
INFO global: VAGRANT_LOG="info"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/2.2.3/gems/vagrant-2.2.3/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded"
INFO global: VAGRANT_INSTALLER_ENV="1"
WARN global: resolv replacement has not been enabled!
INFO manager: Registered plugin: NFS synced folders
@mlazowik
mlazowik / reported.html
Last active April 10, 2018 08:10
non-trivial blocktrans
<span class="text-danger">
{% if is_admin and post.reported_by %}
{% full_name post.reported_by as reporter_link %}
{% blocktrans trimmed %}
This post was reported by {{ reporter_link }}
{% endblocktrans %}
{% else %}
{% trans "This post was reported" %}
{% endif %}
</span>