A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label keys. Show all posts
Showing posts with label keys. Show all posts

Improve website usability, with Javascript

// You need a certain control to be clicked when you press a certain button? Such codez!

window.addEventListener('keyup', function(event) {

  if (event.keyCode === 27) { // escape

        $('.component---BWa8p').focus().click();

  }

});

On which table should the foreign key be defined?

For simple relational databases the foreign key is usually defined on one table only:
  • For join tables (linking tables), put the foreign keys on the join table itself.
  • For lookup tables, don't put the foreign key on them, put it on the other (main) table.

Fix home and end keys in remote shell

$ od -c

<home key pressed>   ^[[7~
<end key pressed>    ^[[8~

Then put in /etc/inputrc or ~/.inputrc:

"\e[7~": beginning-of-line
"\e[8~": end-of-line

An actual example:

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[3~": delete-char

(source)

Perl: Disable control-C and control-Z

$SIG{'INT'} = 'IGNORE'; # Ctrl-C
$SIG{'TSTP'} = 'IGNORE'; # Ctrl-Z