asynchronous – Syntax for TypeScript Arrow Functions With Generics

I don’t know if this is done properly or not, but I posted an answer in StackOverflow back in Sept. 2020 about implementing generics in TypeScript. I got downvoted 3 times, and I was wondering if the following piece of code was problematic:

This is how I defined an async generic function expression in TypeScript

const request = async <T>(param1: string, param2: number) => {
  const res = await func();
  return res.response() as T;
}

And a more complex pattern, in case you’d like to wrap your function inside a generic counterpart, such as memoization (Example uses fast-memoize):

const request = memoize(
  async <T>(
    url: string,
    token?: string
  ) => {
    // Perform your code here
  }
);

See how you define the generic after the memoizing function.

This function has worked well for me, so I don’t see any issues.

This is the original SO question.

ssh – Arrow keys not working when using PuTTY plink command connect CentOS 7 in windows terminal?

I want to connect CentOS7 in Windows Terminal, when I use command: ssh root@192.168.50.160, the arrow keys works well, but ssh command can’t enter password automatically.

So, I use puTTY plink command: plink -ssh 192.168.50.160 -l root -pw password, but the arrow keys is not working.

How to fix this? Or is there another way to connect to linux can enter password automatically in Windows Terminal?

modal windows – Should a popover include an arrow or not?

I’m trying to decide if popover panels should include an arrow pointing to the component that triggered it, or if this is an unnecessary element.


Others’ Approach

Here are some of my research on this topic:

A popover includes an arrow pointing to the location from which it emerged.”
documented from Apple Human Interface Guidelines

Old version of facebook’s dialogs:

Arrow was attached in all the dialog to strengthen the association between the trigger and the dialog.

enter image description here

New version of facebook’s dialogs:

Arrow is taken away.
Highlight the appearance of the icon if the associated dialog is opened.

enter image description here


My Opinion

An arrow helps users to get understand the location from where the popover is coming, and the element that triggers the popover.
Especially there are mutiple triggers (like above facebook example), an arrow additionally helps users distingush between the association easily.

Like this below example, if the content text of the tooltip is too long, it possibly would misunderstand users that the tooltip indicates the item next to the trigger itself at first glance.

enter image description here

My opinion is if there is only one trigger element, then a popover without arrow is appropriate.

And vice versa, if there are more than one trigger element that would pop up a dialog or popover or tooltip, then attaching an arrow would be better.

Is this correct?

modal windows – A Popover with Arrow / without Arrow

How do you think about whether a popover should include an arrow or not?


Others’ Approach

Here are some of my research on this topic:

A popover includes an arrow pointing to the location from which it emerged.”
documented from Apple Human Interface Guidelines>

Old version of facebook’s dialogs:
Arrow was attached in all the dialog to strengthen the association between the trigger and the dialog.

enter image description here

New version of facebook’s dialogs:
Arrow is taken away.
Highlight the appearance of the icon if the associated dialog is opened.

enter image description here


My Opinion

An arrow helps users to get understand the location from where the popover is coming, and the element that triggers the popover.
Especially there are mutiple triggers (like above facebook example), an arrow additionally helps users distingush between the association easily.

Like this below example, if the content text of the tooltip is too long, it possibly would misunderstand users that the tooltip indicates the item next to the trigger itself at first glance.

enter image description here

In conclusion, my Opinion is if there is only one trigger element, then a popover without arrow is allowed.

And vice versa, if there are more than one trigger element that would pop up a dialog or popover or tooltip, then attaching an arrow would be better.


Please leave your thoughts or feedback.
I am so dying to know all your viewpoints !!!! thanks~

email – How to configure Google’s Gmail web-app client to use arrow keys as keyboard shortcuts?

I am one of the few fortunate people in the world to have one of those fancy new keyboards with arrow keys. You too? Amazing!

Apparently, the developers at Google still treat us like we are all still using the ADM-3A terminal.

The wonderfully adorable ADM-3A terminal

Given that we’re actually using technology that was developed this century, how do we get Google’s Gmail web-app to adapt to the wonders of the modern world? Specifically, how can one configure the Gmail web-app to use the arrow keys to go to the previous/next email conversation?

terminal – Mission Control Won’t Open and How Do you set up control + up arrow to make it work

Hello I’m trying to use the control + up arrow to see my desktops/apps that are open but it’s not working. I have spaces enabled and for some reason, the mission control won’t work. I have tried the “killall Dock” in the terminal but that doesn’t work. Please help!

Eslint Arrow function has a complexity of 21. Maximum allowed is 20

Hey guys I got a linting error I wanna know why is it too complex?? and what happens if I just split it into multiple functions is that performant ?? as I know we always have to write minified code so if we split it into multiple functions it will consume more space (bits) and more excecution time ??
and what is the best practice to deal with this snippet.

const getWeekType = (f, d, e) => {
  const y = moment(),
    a = moment(f),
    i = moment(d);
  if (d && f && i.diff(a, 'days') <= 8 && y.diff(a, 'days') < 8 && y.diff(a, 'days') >= 0) {
    return { weekNum: 0, dayNum: y.diff(a, 'days') };
  }
  if (f && y.diff(a, 'days') >= 0 && y.diff(a, 'days') < 8 && (!d || i.diff(a, 'days') > 8)) {
    return { weekNum: 1, dayNum: y.diff(a, 'days') };
  }
  if (d && !f && i.diff(y, 'days') >= 0 && i.diff(y, 'days') < 8) {
    return { weekNum: 2, dayNum: 6 - i.diff(y, 'days') };
  }
  if ((!f || y.diff(a, 'days') > 8) && (!d || i.diff(y, 'days') > 8)) {
    let d = y.diff(f ? a : moment(e), 'days');
    for (; d > 7; ) d -= 7;
    return { weekNum: 3, dayNum: d };
  }
};

linux – zsh bindkey does not change behavior of up and down arrow keys

I want to change the key bindings of the up and down arrow keys. By default I have:

bindkey
...
"^[[A" up-line-or-history
"^[[B" down-line-or-history
...

I have added these lines to my .zshrc:

bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search

This does not change the behavior, although the bindings have changed:

bindkey
...
"^[[A" up-line-or-search
"^[[B" down-line-or-search
...

I can bind up-line-or-search to other keys, such as ‘^R’ just fine. This problem persists in both emacs mode and vim mode. I am binding the correct keys:

showkey -a

Press any keys - Ctrl-D will terminate this program

^[[A  27 0033 0x1b
      91 0133 0x5b
      65 0101 0x41
^[[B  27 0033 0x1b
      91 0133 0x5b
      66 0102 0x42

d3.js – SVG Line arrow head shade

I have following SVG:

   ` svg.append('line')
.style('stroke', '#6236FF')
.style('stroke-width', 3)
.attr('x1', 0)
.attr('y1', (domainheight / 2))
.attr('x2', domainwidth)
.attr('y2', (domainheight / 2))
.attr("marker-end", "url(#triangle2)");

svg.append("svg:defs").append("svg:marker")
.attr("id", "triangle2")
.attr("refX", 5)
.attr("refY", 4)
.attr("markerWidth", 9)
.attr("markerHeight", 9)
.attr("orient", "auto")
.append("path")
  .attr("d", "M0,0 L0,8 L9,4 z")
  .style("fill", "#6236FF"); `

It’s look like:
enter image description here

But It’s need to make look like this:
enter image description here

Please have a look.

computer science – Arithmetic operations on Knuth arrow notation

I want to create a game that explores massive numbers (on the scale of Tree 3, G64, etc.). Normal scientific notation is too small, so common BigNum or alike libraries aren’t capable of this.
I would imagine numbers would be stored in arrow notation, notably up arrow notation.

Representing these numbers is simple, but my question is how to do operations on them. For example, these up arrow notated numbers:

$a ↑↑↑ b + c ↑↑↑ d$

$a↑^nb + c↑^kd$

$(a↑↑↑b)*(c↑↑↑d)$

I’m also interested in arithmetic with chain arrow notated numbers too. (chained arrow notation)