Skip to content

Instantly share code, notes, and snippets.

var channels = ["A", "B", "C"];
channels.forEach (function (channel) {
 channels.push ("D"); // this item will be ignored
 console.log (channel);
})
console.log (channels);
// ['A', 'B', 'C', 'D', 'D', 'D']
var channels = ["A", "B", "C"];
channels.forEach(function(channel) {
  channels.push("D"); // this item will be ignored
console.log(channel);
})
var names = ['adam', 'brian', 'charles'];
function printsName (name) {
 console.log (name);
}
names.forEach (printName);
var names = ['adam', 'brian', 'charles'];
names.forEach (function (name) {
 console.log (name);
});
// adam, brian, charles
var names = ['adam', 'brian', 'charles'];
for (var i = 0; i <names.length; i ++) {
console.log (names [i]);
}
// adam, brian, charles
var fruits = ['pineapple', 'apple', 'grape'];
for (var i = 0; i <fruits.length; i ++) {
// iteration body
}
@cesarkohl
cesarkohl / gist:fe66ff6d059f9a88ce6eb1c4c74e853d
Created August 12, 2019 12:29
Revert php artisan serve
press ctrl+ c
> lsof -i :8000
to check if the port is busy or not if any process is listening to the port 8000 it will be displayed with port id
> sudo kill -9 [PID]
kill the process that listen to that port id
run lsof agin
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class Father {
// Property
public $lastName;
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class Person {
protected $name = 'No Name';
private $birthYear = 'No Year';
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class BankAccount {
private $agency;
private $account;