Skip to content

Instantly share code, notes, and snippets.

View alexzhernovyi's full-sized avatar

Alex Z alexzhernovyi

View GitHub Profile
@alexzhernovyi
alexzhernovyi / gist:bc196370a1d2b754d19589431d8723a1
Last active October 23, 2019 15:17
Differences between git merge and git rebase

Merge IS:

• git merge apply all unique commits from branch A into branch B in one commit with final result • git merge doesn’t rewrite commit history, just adds one new commit

Rebase is:

• git rebase gets all unique commits from both branches and applies them one by one • git rebase rewrites commit history but doesn’t create extra commit for merging

Differences between git merge and git rebase

@alexzhernovyi
alexzhernovyi / Forexamples.java
Last active March 20, 2018 13:43
Loop "FOR"
for(initialization; condition ; increment/decrement)
{
statement(s);
}
////////// Standart use of "for"
for(int a=29; a>=1; a--){
System.out.println("The value of a is: "+a);
////////// Infinite "for" loop
class infiniteex {
@alexzhernovyi
alexzhernovyi / NumChecker.java
Created March 20, 2018 13:05
NumChecker.java
package com.company;
import java.util.Scanner;
public class Main {
public static void main(String ... args) {
int number;
int answer = 0;
boolean boo = true;
@alexzhernovyi
alexzhernovyi / abstraction
Last active March 16, 2018 16:12
OOP Principles
Data Abstraction is the property by virtue of which only the essential details are displayed to the user. The trivial or the non-essentials units are not displayed to the user. Ex: A phone is viewed as a phone rather than its individual components.
class Phone{
int name;
int size;
int type;
int country;
}
@alexzhernovyi
alexzhernovyi / DependencyInversion
Last active March 16, 2018 11:11
SolitPrinciples
// High-level modules shouldn’t depend on lower-level modules. All of them must depend on abstractions.
// Abstractions shouldn’t depend on the details. Details must depend on the abstractions.
class Michel {
private $foodProvider
public function (IFoodProvider $foodProvider){
$this -> foodProvider = $foodProvider
}
public function eat () {
$food= $this -> foodProvider -> getFood();