Skip to content

Instantly share code, notes, and snippets.

:octocat:

Tarik Guney tarikguney

:octocat:
Block or report user

Report or block tarikguney

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tarikguney
tarikguney / iterator_pattern_sample.cs
Last active Feb 10, 2020
Iterator Pattern Sample: Collecting money from briefcase
View iterator_pattern_sample.cs
class Program {
static void Main(){
Canta paraDoluCanta = new Canta();
var zengin = new Yazilimci(paraDoluCanta) { Isim="Tosun", Yas=21 }
// Zengin birisi olarak, farkli ozelliklerimi farkli siniflar ile temsil ediyorum.
// Mesela para sayma ozelligim: ParaSayar, saldiri ozelligim: HizliVeOfkeli, vs.
// GetIterator() genelde standard bir isim. Onun icin kullandim. Geriye Iterator ustipinden ParaSayar tipini gonderiyor.
ParaSaymaIterator paraSayanOzelligim = zengin.GetIterator();
double toplamPara = 0;
@tarikguney
tarikguney / login-form.component.css
Last active Jan 11, 2019
Login Form Design in Angular Material
View login-form.component.css
.login-form-flex {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.button-flex-container {
display: flex;
width: 100%;
View account-checker.cs
public class AccountChecker{
public bool Exists(Account account){
//....
}
public bool ExistsInAmazonWebServices(Account account){
//....
}
public bool ExistsInAzure(Account account){
//....
View aggregation-with-inheritance.cs
public class Account{
private ILogin _loginInfo;
private IProfile _profileInfo;
public Account(IProfile profileInfo, ILogin loginInfo){
_loginInfo = loginInfo;
_profileInfo = profileInfo;
}
}
@tarikguney
tarikguney / Aggregation.cs
Created Oct 8, 2017
Composition vs. Aggregation
View Aggregation.cs
public class Account {
private Profile _profileInfo;
private Login _loginInfo;
public Account(Profile profileInfo, Login loginInfo){
_profile = profileInfo;
_loginInfo = loginInfo;
}
}
@tarikguney
tarikguney / http_get.go
Created Jul 12, 2017 — forked from ijt/http_get.go
Example of using http.Get in go (golang)
View http_get.go
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
View Unit-test-example-for-medium.cs
public class AccountCreatorTest{
private IAccountChecker _accountCheckerMock;
private IAccountRepository _accountRepositoryMock;
[TestInitialize]
public void Initialize(){
_accountCheckerMock = new AccountCheckerMock();
_accountRepositoryMock = new AccountRepositoryMock();
}
@tarikguney
tarikguney / unit-test-dependency-injection.cs
Last active Feb 3, 2017
Unit Testing with Dependency Injection
View unit-test-dependency-injection.cs
public class AccountCreator{
// Interface'ler tanımlıyoruz. Dolayısıyla kendi sınıflarımızı rahatlıkla kullanabiliriz.
private IAccountChecker _accountChecker;
private IAccountRepository _accountRepository;
// Dependency'lerimizi constructor method vasıtasıyla enjekte ediyoruz.
public AccountCreator(IAccountChecker accountChecker, IAccountRepository accountRepository){
_accountChecker = accountChecker;
_accountRepository = new accountRepository;
}
View ninject-code-sample.cs
public class WarriorModule : NinjectModule
{
public override void Load()
{
this.Bind<IWeapon>().To<Sword>();
}
}
@tarikguney
tarikguney / account-creator-used-in-main-method-medium.cs
Created Jan 31, 2017
Account Creator Used in Main Method For Medium
View account-creator-used-in-main-method-medium.cs
public class Program{
public static void Main(string[] args){
AccountCreator accountCreator = new AccountCreator(new DatabaseAccountChecker());
var accountInfo = GetAccountInfoFromSomewhere();
var result = accountCreator.TryCreateAccount(accountInfo);
Console.WriteLine("Account Creation was succesfull? " + result);
}
}
You can’t perform that action at this time.