Skip to content

Instantly share code, notes, and snippets.

View mohokh67's full-sized avatar
💭
Working hard, typing slow 😎😎

MoHo mohokh67

💭
Working hard, typing slow 😎😎
View GitHub Profile
@mohokh67
mohokh67 / Install nginx, php7.1 and setup a virtual host in ubuntu.md
Last active January 23, 2018 08:10
How to install nginx, php7.1 and setup a virtual host in Ubuntu

Install Nginx and add a virtual host

  • First, make sure the Ubuntu Repo. is up to date.
sudo apt-get update
  • Check if Nginx is install in you machine:
nginx -v
@mohokh67
mohokh67 / Install PHP 7.1 with Nginx on Ubuntu 17.10.md
Created January 23, 2018 08:09
Install PHP 7.1 with Nginx on Ubuntu 17.10

Install PHP 7.1 with Nginx on Ubuntu 17.10

Follow these steps to inatll php 7.1 and most common modules:

sudo apt-get update
  • Install PHP 7.1
@mohokh67
mohokh67 / Xdebug.md
Last active January 24, 2018 15:47
Configure XDEBUG and PHPStorm

Configure Xdebug

  1. Copy all phpinfo() output to this URL: https://xdebug.org/wizard.php
  2. Copy the file and follow the instrcution
  3. Add follow lines to the end of php.ini to make it work with PHPStorm
[XDEBUG]
zend_extension = C:\xampp\php\ext\php_xdebug-2.5.4-7.1-vc14.dll
xdebug.remote_enable = true
xdebug.idekey = PHPSTORM
@mohokh67
mohokh67 / Run PHPUnit from PHPStorm.md
Created January 24, 2018 15:49
Run PHPUnit from PHPStorm

Run PHPUnit from PHPStorm

  1. Under settings dialog, go to test framework (e.g. under PHP language)
  2. Add a test framework
  3. Choose Composer autoloader
  4. Choose vendor/autoload.php
  5. Choose phpunit.xml in the current project for the default configuration file
  • Go to test directory where it contains all the PHPUnit tests, right click and choose run test or do the same on every individual tests file
@mohokh67
mohokh67 / Install Composer in Ubuntu.md
Last active February 10, 2018 13:05
Install Composer in Ubuntu

How to install composer in Ubuntu

In this short article we are going to install composer php packages manager in Ubuntu 16 and above.

  • Make sure php is installed by typing php -v in terminal. otherwise install PHP with this command:
sudo apt-get update
sudo apt-get install php
@mohokh67
mohokh67 / async_await.js
Created July 6, 2018 14:04
JavaScript ES6 async await
function doubleMe(name, x) {
console.log('I am running ' + name);
return new Promise(resolve => {
setTimeout(() => {
resolve(x * 2);
console.log('hoooo');
}, 2000);
});
}
@mohokh67
mohokh67 / nodemon_babel.json
Created July 9, 2018 12:42
Run Nodemon with BabelJs
{
"name": "Babel with Nodemon",
"version": "1.0.0",
"description": "",
"main": "public/index.js",
"scripts": {
"start": "node ./public/index.js",
"start:dev": "nodemon ./public/index.js",
"clean": "rm -rf dist",
"build": "npm run clean && mkdir dist && babel app -d dist --copy-files",
@mohokh67
mohokh67 / deployToNetlify.md
Last active November 19, 2018 07:29
Deploy single page app with react to Netlify

Deploy single page app with react to Netlify

After installing the main package as we need it for deploy:

npm i netlify-cli -g

Build the app with this command:

npm run build
@mohokh67
mohokh67 / terminal.md
Last active February 12, 2019 16:05
Customise terminal prompt

Customise terminal prompt in ubuntu

This one will only prompt the current directory

export PS1='\W > '

Git branch

parse_git_branch() {
@mohokh67
mohokh67 / deployToNow.md
Last active March 6, 2019 12:49
Deploy single page app with react to zeit/now

Deploy single page app with react to zeit/now

After installing these two packages as we need them for deploy:

npm i now -g
npm i serve

follow these steps: