Skip to content

Commit

Permalink
1.0.43
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed Aug 25, 2017
2 parents 76acf43 + 2691ae1 commit c907c68
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 24 deletions.
41 changes: 21 additions & 20 deletions src/css/blog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

.banner__blog {
position: fixed;
left:0;
right:0;
top:0;
left: 0;
right: 0;
top: 0;
height: 70vh;
background: $color-orange;
background: linear-gradient(20deg, $color-red, $color-orange);
Expand All @@ -29,14 +29,14 @@
border-radius: 2px;

@media (max-width: $with-container-mobile) {
padding:0;
padding: 0;
background: none;
color:$color-red;
font-size:.9em;
line-height:1em;
margin-left:0;
color: $color-red;
font-size: .9em;
line-height: 1em;
margin-left: 0;
display: block;
margin-top:.3em;
margin-top: .3em;
}
}

Expand All @@ -45,7 +45,7 @@
position: relative;
padding: 2em 7em 1em;
box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.2);
max-width:1000px;
max-width: 1000px;

@media (max-width: $width-container) {
box-shadow: none;
Expand All @@ -61,7 +61,7 @@
margin-top: 20vh;

article {
margin:0 auto;
margin: 0 auto;
position: relative;
z-index: 20;

Expand Down Expand Up @@ -91,14 +91,15 @@
font-size: 1.4em;
color: lighten($color-black, 15);
width: 70%;
margin: 1.5em 0 2em 3em;

&:before {
display: inline;
content: '"';
float:left;
float: left;
margin-left: -.6em;
margin-top:-.2em;
color:$color-red;
margin-top: -.2em;
color: $color-red;
font-size: 2em;
}

Expand Down Expand Up @@ -127,7 +128,7 @@
}

article + article {
margin-top:4em;
margin-top: 4em;

&:before {
display: block;
Expand All @@ -141,13 +142,13 @@

article.blog {
& > h1 {
font-size:2em;
margin-top:1.5em;
margin-bottom:1em;
font-size: 2em;
margin-top: 1.5em;
margin-bottom: 1em;
}

& > p {
line-height:1.6em;
font-size:1.2em;
line-height: 1.6em;
font-size: 1.2em;
}
}
4 changes: 2 additions & 2 deletions src/data/about/about.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# About Stitcher and myself

My name is Brent, I'm a 22 years old web developer living in Belgium. My interest in websites and web development started around the age of 12, and I've been coding ever since. I've finished my bachelor degree "Applied Informatics" in Leuven in 2014.
My name is Brent, I'm a 23 years old web developer living in Belgium. My interest in websites and web development started around the age of 12, and I've been coding ever since. I've finished my bachelor degree "Applied Informatics" in Leuven in 2014.

The last two years, I've been working for a company named [Statik](*https://www.statik.be), where I'm a backend PHP developer. Besides my daytime job, I also work on some side projects to help churches and Christian organisations in my area. And on top of that, the cherry on the cake, my own favourite project: Stitcher, in which I try to push myself and websites to a whole new level.
The last three years, I've been working as a backend PHP developer. Besides my daytime job, I also work on some side projects to help churches and Christian organisations in my area. And on top of that, the cherry on the cake, my own favourite project: Stitcher, in which I try to push myself and websites to a whole new level.

The idea behind Stitcher originated early 2016, when a lot of "predictions for the web in 2016" blog posts appeared. Some performance issues caught my eye, and made me think about what a website really is. After a year of tinkering, tryouts and development, Stitcher was born. If you want to know exactly what Stitcher is about, you can read [the guide](*/guide/setting-up).

Expand Down
6 changes: 6 additions & 0 deletions src/data/blog/_blog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
entries:
mastering-key-bindings:
date: 2017-08-25
type: blog
title: Mastering key bindings
teaserTitle: Key bindings
content: data/blog/mastering-key-bindings.md
a-programmers-cognitive-load:
date: 2017-06-25
type: blog
Expand Down
130 changes: 130 additions & 0 deletions src/data/blog/mastering-key-bindings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
*This blog post aims to make you think about the way you use key bindings whilst programming.
You'll read about some techniques I personally use to assign key bindings, how to memorize them, and use them efficiently.
But before we go on, I'll need to explain why spending time on key bindings is worth the effort.*

## The need for keys

I can't point to some psychological study to back this claim, just my own experience and common sense.
Using the mouse as less as possible when coding is a good thing.
You're not moving your hands around to grab the mouse, and you don't have to make the mental switch
between using a keyboard and a mouse as input device.

I believe these small things have to power to improve our skills as professional programmers significantly.
I've experienced a lot of gain by taking the time to learn to use the keyboard as often as I can.
While I'm still searching the optimal setup, I can already share some thoughts and techniques.
The most important thing to know is that key bindings are probably a matter of personal taste,
so don't take these next points as law; but rather apply them to your own situation.

> Key bindings are a personal preference.
## The meaning of modifiers

A keyboard has a few modifier keys, which allow you to modify the behaviour of other key presses.
A long time ago these keys were actually hard wired in the keyboard, to change the electronic bits sent to the computer.
Nowadays, modifier keys are implemented completely different, but it's still good to look at what their original meaning was.
It helped me define a formal definition for each modifier key, allowing me to remember what key combination belongs to which action.

> Define a personal meaning for each modifier key,
<br>and stick to it.
### Meta/Command (⌘)

I use this key when "executing" commands. Basically most of what's possible through the menu of an application.

### Option/Alt (⌥)

Alt stands for "alternate", changing the behaviour of another key combination. I use this key for a related action
of another key binding.

### Shift (⇧)

Shift has a double meaning. First it's used for selections, because that's default OS behaviour.
Second, it's also often used to reverse the action.

I prefer a maximum of two modifier keys, and if complexer combinations are needed, opt for **double key bindings**.
One exception though: Shift (⇧) may be used in combination with other modifier keys to reverse the action.

> Prefer a maximum of two modifier keys,
<br>or use double key bindings.
### Control/Ctrl (^)

The control key is used mostly for text- and code related manipulations, like moving the cursor, working with selections,
working with lines, etc.
I find it hard to give a formal definition for the Control key, but its use is clear in most cases.

A note for Windows users: the Control key is much more used in comparison to the Meta (Windows) key.
Meaning you probably want to switch the definition of the two, or even ditch the Meta key.
Even though this might seem like a good idea, adding the meta key in your workflow can be a good thing,
as it adds another modifier key to your availability.

### Function (fn)

Because the function key is often not accessible on desktop keyboards, I choose not to depend on this key,
except for some edge cases like page-up or page-down.

## Learning

Keeping my own definitions in mind, it's easy to start defining key bindings. Though to remember them requires practice.
I'd recommend not assigning all key bindings at once, but rather slowly add them when you need them.

> Assign new key bindings when you need them.
I choose not to override operating system (OS) key bindings. Things like `copy`, `paste`, `select all` or `quit` are
never overridden.
Key binding defaults provided by your IDE or editor, however, may be changed.
If you come from Sublime Text like me, you've probably learned some defaults from there which feel accustomed.
When switching to PHPStorm a few years ago, I decided to keep some of those key bindings I knew from Sublime.

> There's no need to change OS-level key bindings
<br>like `copy` or `select all`.
Even now, I'm still changing key bindings from time to time. Especially when I came up with my definition list.
One thing I find useful when learning new key bindings, is to disable the old ones. IDEs like PHPStorm allow you to add
multiple combinations for the same action. I prefer to immediately notice when I'm using an old combination.
This makes me learn faster.

> Remove key bindings you wish to unlearn.
Furthermore, when stuck in a situation, I try not to immediately grab the mouse.
I try to think the problem and define what I want to do.
Most of the time, I can remember which combination of keys should be pressed, because of the definition list above.
When my memory fails me, I'm lucky to be working in an IDE with awesome key binding management,
so it's easy to find the correct combination back.

> Don't grab the mouse when panicking.
You keymap is a very personal file, which slowly grows to match your workflow the best. I recommend you storing a backup
of your keymap somewhere else, GitHub would be a good place. Here's mine:
[https://github.com/brendt/settings-repository/blob/master/keymaps/Brendt.xml](https://github.com/brendt/settings-repository/blob/master/keymaps/Brendt.xml)

> Check your keymap into version control.
---

### A few of my own examples

- `⌘ p` Search file
- `⌘ ⇧ p` Search recent files
- `⌘ ⌥ p` Search symbols in file
- `⌘ ⌥ space` Show suggestions
- `⌘ ⌥ enter` Go to declaration
- `^ ⌥ →` Move right with camelHops
- `^ ⌥ ←` Move left with camelHops
- `⌥ ↑` Move cursor paragraph up
- `⌥ ↓` Move cursor paragraph down
- `⇧ ⌥ ↑` Extend selection
- `⇧ ⌥ ↓` Shrink selection

## Closing thoughts

I grew in love with key bindings over the years. I still use a mouse for basic navigation,
but once I start coding, I try to use it as little as possible. I find that it's easier to work this way.
Not only do I gain time by not switching as often to the mouse; I also find it puts less cognitive load on my brain,
meaning I'm able to concentrate more on coding.

This might seem like a small thing to do, but as a professional programmer, you're doing those small things many,
many times a day. It's worth taking the time to optimise these areas and skills, I find they make me a better programmer.

Do you want to read more about cognitive load? I've written about [fonts and visuals](*https://www.stitcher.io/blog/a-programmers-cognitive-load)
in a previous blog post. Do you still have a question or something on your mind? [Send me an email](mailto:[email protected])!
68 changes: 68 additions & 0 deletions src/data/blog/my-keymap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@


## Commands

- `⌘ ⇧ ]` Next Tab
- `⌘ ⇧ [` Previous bab
- `⌘ ⇧ ⌥ ]` Next in-editor tab
- `⌘ ⇧ ⌥ [` Previous in-editor tab

===

- `⌘ p` Search file
- `⌘ ⇧ p` Search recent files
- `⌘ ⌥ p` Search symbols in file
- `⌘ o` Action

===

- `⌘ enter` Enter below line
- `⌘ ⇧ enter` Enter above line

===

- `⌘ ⌥ space` Suggestions
- `⌘ ⌥ enter` Declaration

## Cursor

- `⌥ →` Move cursor word left
- `⌥ ←` Move cursor word right
- `^ ⌥ →` Move right with camelHops
- `^ ⌥ ←` Move left with camelHops
- `⌘ →` Move cursor to end of line
- `⌘ ←` Move cursor to start of line

===

- `⌥ ↑` Move cursor paragraph up
- `⌥ ↓` Move cursor paragraph down
- `^ ⌥ ↑` Add extra cursor up
- `^ ⌥ ↓` Add extra cursor down
- `⌘ ⌥ ↑` Move current line up
- `⌘ ⌥ ↓` Move current line down

## Selection

- `⇧ →` Select left
- `⇧ ↓` Select down
- `⇧ ←` Select right
- `⇧ ↑` Select up
- `⇧ ⌥ ←` Select word left
- `⇧ ⌥ →` Select word right
- `⇧ ^ ⌥ ←` Select word left with camelHops
- `⇧ ^ ⌥ →` Select word right with camelHops
- `⇧ ⌥ ↑` Expand selection
- `⇧ ⌥ ↓` Shrink selection
- `⇧ ^ ↑` Select line
- `⇧ ^ ↓` Deselect line
- `⇧ ⌘ d` Duplicate selection
- `⌘ d` Select duplicates
- `⌘ u` Undo selection

## Folding

- `⌘ +` Fold out
- `⌘ -` Fold in
- `⌘ ⇧ +` Fold all out
- `⌘ ⇧ -` Fold all in
4 changes: 2 additions & 2 deletions src/template/blog/detail.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</article>

<footer>
<nav>
<nav class="spacer">
{if $browse.prev}
{$title = $browse.prev.title}

Expand All @@ -41,7 +41,7 @@
<a class="prev cta cta--ghost" href="/blog/{$browse.next.id}">Previous post: {$title}</a>
{/if}
</nav>
<nav class="center">
<nav class="center spacer">
<a class="cta cta--link" href="/blog">Back to overview</a>
</nav>
</footer>
Expand Down

0 comments on commit c907c68

Please sign in to comment.