Skip to content

Instantly share code, notes, and snippets.

@afzafri
Last active February 8, 2018 18:40
Show Gist options
  • Save afzafri/f9f40649d7cc70a157969850db17c46f to your computer and use it in GitHub Desktop.
Save afzafri/f9f40649d7cc70a157969850db17c46f to your computer and use it in GitHub Desktop.
List of tutorials that I have done

Tutorials By Afif - https://github.com/afzafri

Quick Links:

  1. Lession 1 - Git
  2. Lession 2 - PHP

Lesson 1 - Git

1. Introduction

Ok cara nak setup git untuk project ada 2.

Which is:

  1. create repo kat github, git clone, copy paste file, git push
  • No 1 pulak, kita git clone dari github, which is macam download lah. nanti ada folder baru. next kita copy paste ja source code masuk folder baru tu. Tak perlu initialize git dah.
  1. create repo kat github, initialize git dekat folder project, add origin (link ke repo github), git push
  • no 2 ni kan, let say dah ada folder project, dalam tu ada source code semua tu kan. haa so kita masuk ke folder tu, initialize git kat folder tu.

2. Create repository

Create repo baru kat GitHub. buat ja nama apa pun.

Repository name: name of project

Description: description of project

3. Launching Git Bash

lepas dah create repo, kena bukak Git Bash.

  1. Go to any folder, macam Desktop.
  2. Right click > Git Bash Here
  3. lepas tu akan keluar CMD
  4. bila buat git bash here ni, cmd tu akan automatik directory dia set kat tempat yang kita bukak tu.

Contoh, kita masuk folder "project", dan kita buat git bash here tu, cmd tu akan set current directory tu dalam folder "project"

4. Git Clone (downloading our project)

Next kita nak download repository project kita ke laptop.

  1. ok dekat cmd tadi, run command ni:

git clone URL "namafolder"

URL: link yang copy tadi

"namafolder": optional, nak tulis boleh taknak pun takpa. Kalau tak tulis, nama folder tu akan ikut nama repository

  1. Lepas dah git clone, dia akan create new folder dngn nama kita letak tu. nanti coding project campak dalam tu.
  2. Okok so next, kita kena masuk dalam folder tu, iaitu change current working directory.

Ada 2 cara:

  • Tutup git bash sekarang, masuk folder tu, buat git bash here lagi
  • Atau, just type: cd "folderproject"

cd ni, "change directory". Maksud nya kita guna cmd tu untuk masuk folder tu, change current directory.

5. Git Add (add our files to list)

Ok sekarang try copy paste, atau create file baru dalam folder yang kita clone tu.

Ok then kat git bash tadi, run commands ni:

  1. git status
  • command ni untuk check, folder tu ada sebarang perubahan baru tak mcm ada file baru, or edit file. kalau warna merah, maksud nya file tu dah diubah/baru dan belum ada dalam senarai commit. Kalau warna hijau, file tu dah ada dalam senarai
  1. git add "namafile" or git add .
  • command ni untuk kita masukkan file yang kita nak commit dan upload kedalam list.

kalau letak namafile tu, kita cuma add 1 file. Kalau letak titik tu, kita add semua file ysng berubah

6. Git Commit (saving our files)

Next kita nak commit, which is save list tu dah bagi reason modification.

Run command ni di git bash:

git commit -m "sebab"

  • sebab: description files, mcm buat perubahan apa kat file tu. contoh mcm file baru buat, tulis je mcm "create file page"

7. Git Push (upload our files to github)

So final step is push which is upload to github

Run command ni:

git push -u origin master

origin: folder local kita sekarang

master: branch dekat github

8. Git fetch (fetch updated list)

So bila di remote repository ada sebarang update or perubahan. Kita kena update local files. Cara dia dengan run fetch dan pull

Command:

git fetch

9. Git Pull (fetch new updated files)

Command:

git pull

10. README.md file, Markdown markup language

ni official guide

https://guides.github.com/features/mastering-markdown/

11. LICENCE file

  1. Go to GitHub repo page
  2. tekan Create new file
  3. file name type "LICENSE" huruf besar semua mcm tu. then lepas tu tengok sebelah kanan akan ada button muncul, "Choose a license template". click tu
  4. dia akan list license. nak baca pun boleh dia ada tulis. selalu project biasa2 kita ambik MIT je.
  5. bila dah pilih license, haa tu dia tunjuk ciri2 license tu. then kita just perlu tulis year dan name je. tu pun dah automatik depa tuliskan. So next tekan butang hijau.
  6. ok so dia ada keluar page baru tulis license tu kan. scroll bawah, tick "Commit directly to the master branch"

12. Ignore file to be upload with .gitignore file

Kita boleh set supaya git tak upload any specific files or folder. Cara dia dengan create file .gitignore .dalam ni kita letak list nama files dan folder yang nak ignore.


Lesson 2 - PHP

1. SETUP AND RUNNING SERVER

STEP 1 - Running server and Mysql db

  • Bukak Xampp, Start both Apache & Mysql

STEP 2 - open webpage server

  • Bukak browser (chrome, firefox etc..), type di search bar atas tu: localhost
  • then enter

STEP 3 - open database page

  • Bukak browser (chrome, firefox etc..), type di search bar atas tu: localhost/phpmyadmin
  • then enter

2. LOCATION LETAK CODING PHP

STEP 1 - Ok first kita kena tau kat mana nak letak coding php, which is, directory web server kita

  • Cara nya, dekat XAMPP, click Explorer
  • pastu akan nampak folder banyak2, just masuk folder htdocs
  • soo taraaaa dalam ni lah kita akan campak2 coding
  • basically, location folder tu is : C:/xampp/htdocs

3. START CODING PHP!

STEP 1 -

  • ok so next, kita kena ada MAIN FILE, index.php
  • so nanti bila bukak link kita tu, server akan run index.php dulu.

STEP 2 - Cara create file php

  • Guna software Notepad++
  • ok mula2 dah bukak notepad++ tu, tekan File -> New File
  • lepas tu File -> Save As, index.php save kat folder project kita tadi

STEP 3 - Hello World PHP

  • Type coding ni dalam file index.php
<?php
  echo "Hello World";
?>

Code Explanation_:_

  1. echo - method untuk display. Macam cout dalam C++ dan SOP dalam Java
  2. anything inside <?php... ?> ialah coding PHP. Luar dari tu is HTML
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment