Skip to content

Instantly share code, notes, and snippets.

View dchenk's full-sized avatar

Dmitriy dchenk

View GitHub Profile
{
"title": "Issue",
"description": "Issues are a great way to keep track of tasks, enhancements, and bugs for your projects.",
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
},
"required": [
// totalCostOverMonths returns the total cost of an amortizing loan given a fixed APR.
const totalCostOverMonths = (
p, /* The principal borrowed */
r, /* The APR / 1200 if APR is taken as a percentage; e.g., with APR of 9%, r = 9/1200 = 0.0075 */
m /* The number of months the mortgage is held for; the number of payments */
) => p * r * m / (1 - Math.pow(1 + r, -m)) - p;

Configure libinput-gestures

Use libinput-gestures

After installing everything, copy the default conf file to: ~/.config/libinput-gestures.conf and replace lines for these options:

gesture swipe up        xdotool key super
gesture swipe down      xdotool key super+a
@dchenk
dchenk / swap-ctrl-alt-gnome.md
Last active November 15, 2023 07:47
Swap CTRL and ALT keys on GNOME

Swap CTRL and ALT keys on GNOME

From here: https://askubuntu.com/a/101877

Create a file called .Xmodmap in your home directory.

$ vim ~/.Xmodmap

Add the following lines to the file:

@dchenk
dchenk / error-handling.md
Created August 29, 2018 05:38
Default error handlers

The draft proposal for better error handling is overall well thought-out and doesn't seem like it'll decrease readability of Go code very much. Readability can be understood a couple of different ways: we might say that conciseness is inherently condusive to readability, but on the other hand we may want explicitness in our code. Thus far Go has preferred the latter form of readability.

The proposed syntax with the check keyword will make the behavior of code slighly less obvious in some places, though not by much. If we've trained ourselves to glaze over each if err != nil { return err } when trying to understand what a function is doing, then with the new syntax we'll eventually get ourselves to glaze over the check keywords at the function calls. So when we see num := check parseNum(stringVar) we'll instinctively and momentarily be forgetting that parseNum returns an error along with the value of interest.

That said, I think that the benefits of the new syntax outweigh these drawbacks. And