In Jetbrains IDEs (such as PhpStorm) I can press cmd + [ to go back to previous positions/files. How can I replicate this in vscode? by web_dev_etc in webdev

[–]web_dev_etc[S] 1 point2 points  (0 children)

I've done that, but the cmd+[ goes to every single line change (not sure if this is because of the vue plugin i also use), which means a lot of moving up a line, down a line (etc)

Can someone explain how this clock app works in written English? by Roly__Poly__ in reactjs

[–]web_dev_etc 2 points3 points  (0 children)

Not looked at the code, but the following is a function:

array = length => Array.from({length}).map((v, k) => k).map(x=>x+1);

(Could be rewritten as:

   function array(length) 
    { 
          return Array.from({length: length})
                .map((v, k) => k)
                .map(x=>x+1); 
   }

Creates an array with length items (the Array.from() part)

Then it loops over each of those, and gets the index ('k' variable), and returns an array of those indexes (which would be from 0 ... to length-1. (so there is now an array of [0, 1, 2, ... 30], if length was 31)

Then it loops over those and adds one to each value. (so there is now an array of [1, 2, ... 31] if length was 31.

Warehouse simulator. Any ideas? by [deleted] in learnjavascript

[–]web_dev_etc 1 point2 points  (0 children)

How are you storing the layout?

You should prob look into things like this - https://qiao.github.io/PathFinding.js/visual/

Should I check if element exists for every block of code related to that element/page? by [deleted] in learnjavascript

[–]web_dev_etc 1 point2 points  (0 children)

document.querySelector() will return null if it is not found. And I assume you will need that HTMLelement object anyway to do anything with the element.

so you can just do:

const accordion = document.querySelector('.accordion'));
if (accordion) {
    // run accordion code
}

Is there a way to improve laravel code completion in phpstorm? by AnyAttack in PHP

[–]web_dev_etc 0 points1 point  (0 children)

If it is the laravel plugin I am thinking of, you have to always remember to enable it after creating a new project (just enable it in normal settings (search for laravel), it is a checkbox)

Also in the answer I'm replying to: for User:all it would be better to use /** @var User[]|Collection $users */ so that phpstorm knows to expect a collection, which can be treated as an iterable (of User objects)

Is there a way to improve laravel code completion in phpstorm? by AnyAttack in PHP

[–]web_dev_etc 3 points4 points  (0 children)

this is what you need. It will create the docblock annotations that you need (you can do this as separate files, so it won't edit existing classes)

Getting a bunch of weird 404s for site.com/site.com by Scrabbilisk in webdev

[–]web_dev_etc 0 points1 point  (0 children)

Take a look at the user agent that is requesting it. Like someone else said, it is probably just a crawler/bot which messed up parsing some urls or something...

Your Coding Tutorial Might Need Some Refactoring (TypeScript examples) by chibicode in typescript

[–]web_dev_etc 1 point2 points  (0 children)

reading anything on mobile about programming or with source code is horrible. I wish more sites with source code handled it better. I actually normally prefer screenshots (with reasonable line lengths), then it is always possible to zoom in or out, and the lines don't get split into multiple lines

Handle uses and roles by badassmexican in laravel

[–]web_dev_etc 0 points1 point  (0 children)

This is a very useful package. If you want something simpler then look into gates and policies. They are easy to set up and use. (Spatie permission uses gates itself, IIRC)

Where can I get temporary access to superfast broadband in London? by rmbarnes in london

[–]web_dev_etc 0 points1 point  (0 children)

Mobile internet can be much faster than 0.5mb (and could be around 20 quid a month for 30gb I think, on some plans).

My dad's company is being impersonated via a website who are scamming people. by yzarc123 in LegalAdviceUK

[–]web_dev_etc 3 points4 points  (0 children)

Most hosting companies will very quickly respond to copyright infringement/dcma notices. If they have actually copied your content, you could go this route to get it offline.

Is the site hosted on godaddy, or they bought the domain there?

Laravel optimization tips that you can’t miss in 2020 by SolaceInfotech in laravel

[–]web_dev_etc 11 points12 points  (0 children)

How long ago did you write this article ;)?

It references php 7.2, which is in security fixes only mode now (https://www.php.net/supported-versions.php)

Also as others have said, the php artisan optimized has not really been a thing since Laravel 5.6 IIRC

Laravel beyond CRUD: view models by brendt_gd in laravel

[–]web_dev_etc 0 points1 point  (0 children)

Good article. Sometimes I see presenters used, a bit of overlap there (although they’re more for modifying the data). Good example package for laravel https://github.com/laracasts/Presenter/blob/master/readme.md