8
May
2018

how to see open connections

08 May 2018
SELECT *
FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE HOST LIKE '%192.168.0.0%';
26
Feb
2018

List git branches that can safely be deleted

26 Feb 2018
git branch --no-merged
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
25
Jan
2018

Fast create MySQL user and db with prevs

25 Jan 2018
CREATE USER 'fast'@'%'
  IDENTIFIED WITH mysql_native_password AS '***';
GRANT USAGE ON *.* TO 'fast'@'%'
REQUIRE NONE
WITH MAX_QUERIES_PER_HOUR 0
  MAX_CONNECTIONS_PER_HOUR 0
  MAX_UPDATES_PER_HOUR 0
  MAX_USER_CONNECTIONS 0;
CREATE DATABASE IF NOT EXISTS `fast`;
GRANT ALL PRIVILEGES ON `fast`.* TO 'fast'@'%';
GRANT ALL PRIVILEGES ON `fast\_%`.* TO 'fast'@'%';
18
Jan
2018

Grab Chome Extension Favicon

18 Jan 2018

If unique favicon is available only via chrome extension. You can grab it:

chrome://favicon/size/48/http://localhost

16
Jan
2018

Carbon & Moment.js

16 Jan 2018
    //  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
12
Jan
2018

xdebug

12 Jan 2018
sudo subl /etc/php/7.1/cli/php.ini
sudo subl /etc/php/7.1/fpm/php.ini


[Xdebug]
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_handler="dbgp"
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="PHPSTORM"
6
Dec
2017

Network Tab fast image save

06 Dec 2017

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

b. In console:

”`js x = [<>]; // 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);
25
Nov
2017

Vuejs 2

25 Nov 2017

Cheatsheet

Preventing easy:

    <a href="#" @click.prevent="toDo();"></a>

Easy event handling:

30
Oct
2017

crontab

30 Oct 2017

1-312 odd days

2-312 even days

15
Sep
2017

MySQL grep table

15 Sep 2017

Cut table from dump:

sed -n -e '/CREATE TABLE.*`mytable`/,/CREATE TABLE/p' mysql.dump > mytable.dump