Carbon & Moment.js

    //  check if expired
    Carbon::parse($createdAt)->addSeconds($this->expires)->isPast();


    // diff in seconds
    $then = Carbon::now()->addMinute();
    $now = Carbon::now();

    $then->diffInSeconds($now, false) // -60
    $now->diffInSeconds($then, false) // 60

// parse string let will_end = '2019-02-01 10:00:00'; let then = moment(new Date(will_end)); // diff in seconds let then = moment().add(1, 'minute'); let now = moment(); then.diff(now, 'seconds'); // 60 now.diff(then, 'seconds'); // -60

@blog #php #js

Network Tab fast image save

a. Right click on an entry in the network log. Then select Copy All as HAR

b. In console:

    x = [<<PASTE HERE>>]; // paste here copied HAR

    (function(logObj, mime) {
      var results = [];
      logObj[0].log.entries.forEach(function (entry) {
        if (mime && entry.response.content.mimeType !== mime) return;
        results.push(entry.request.url);
      });
      console.log(results.join('\n'));
    })(x, 'image/png');  // can be changed type

c. Save links in file

d. wget -i file

js #linux @blog

Projects

Tags

Capsule Servers

Lost connection to server.