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 / 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:

@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 / vscodeInstalledPackages.md
Last active January 28, 2023 06:38
List of my vscode packages

Run this command and it will give you list of in installed packages:

code --list-extensions | xargs -L 1 echo code --install-extension

I have this packages:

code --install-extension christian-kohler.path-intellisense
@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 / 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 / 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 / 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 / fix gitignore.md
Last active February 20, 2025 17:08
Fix the .gitignore and untrack files which are already added

Untrack files which are already added in gitignore file

  1. Commit all your changes

  2. Remove everything from the repository cache. Go to your repo directory and run this command.

git rm -r --cached .

It will only clear the cache. Your files and git history will stay.

@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
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.