<?php
$host    = '127.0.0.1';
$db      = 'test';
$user    = 'test';
$pass    = 'qwerty';
$charset = 'utf8mb4';
$dns = "mysql:host={$host};dbname={$db};charset={$charset}";
$opt = [
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES   => false
];
$pdo = new PDO($dns, $user, $pass, $opt);Design patterns are advanced object-oriented solutions to commonly occurring software problems. Patterns are about reusable designs and interactions of objects. Each pattern has a name and becomes part of a vocabulary when discussing complex design solutions.
The 23 Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral (see below for a complete list).
In this tutorial we provide JavaScript examples for each of the GoF patterns. Mostly, they follow the structure and intent of the original pattern designs. These examples demonstrate the principles behind each pattern, but are not optimized for JavaScript.
grub rescue > ls
(hd0) (hd0,msdos5) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1) (hd1) (hd1,msdos1)
grub rescue > ls (hd0,msdos1) # try to recognize which partition is this
grub rescue > ls (hd0,msdos2) # let's assume this is the linux partition
grub rescue > set root=(hd0,msdos2)
grub rescue > set prefix=(hd0,msdos2)/boot/grub # or wherever grub is installed
grub rescue > insmod normal # if this produced an error, reset root and prefix to something else ..
grub rescue > normalFor a permanent fix run the following after you successfully boot:
sudo update-grub
sudo grub-install /dev/sdX... where /dev/sdX is your boot drive.
rsync is fast and easy:
rsync -av --progress sourcefolder /destinationfolder --exclude thefoldertoexcludeYou can use --exclude multiples times.
Also you can add -n for dry run to see what will be copied before performing real operation, and if everything is ok, remove -n from command line.
Basic:
var Device = function(opt) {
  this.id = opt.id;
  this.type = opt.type;
};
Device.prototype.getId = function() {
  return this.id;
};
Device.prototype.getType = function() {
  return this.type;
}
var Relay = function(opt) {
  // call the inherited constructor
  Device.call(this, opt);
  this.code = opt.code;
};
Relay.prototype.getCode = function() {
  return this.code;
};
// Relay will inherit Device 
Relay.prototype = Object.create(Device.prototype);
var device = new Relay({id: 123, type: 'test', code:'RL-01'});
console.log(device);
console.log(device instanceof Device); // true
console.log(device instanceof Relay);  // trueWith some more structure:
var Device = (function() {
    function F(opt) {
        this.id = opt.id;
        this.type = opt.type;
    }
    F.prototype.getId = function() {
        return this.id;
    };
    F.prototype.getType = function() {
        return this.type;
    }
    return F;
}());
var Relay = (function() {
    function F(opt) {
        // call the inherited constructor
        Device.call(this, opt);
        this.code = opt.code;
    }
    F.prototype.getCode = function() {
        return this.code;
    }
    // Relay will inherit Device 
    F.prototype = Object.create(Device.prototype);
    return F;
}());
var device = new Relay({id: 123, type: 'test', code:'RL-01'});
console.log(device);
console.log(device instanceof Device); // true
console.log(device instanceof Relay);  // true