Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

umut yerebakmaz umutyerebakmaz

💭
I may be slow to respond.
Block or report user

Report or block umutyerebakmaz

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
@umutyerebakmaz
umutyerebakmaz / auth-route.guard.ts
Created Feb 27, 2020
Rollere dayalı route koruması.
View auth-route.guard.ts
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
import { LoginMeGQL } from '@generated-types';
@Injectable({
providedIn: 'root'
})
export class AuthRouteGuard implements CanActivate {
constructor(
private router: Router,
View user-yorumlar.module.ts
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { UserUserQuery, UserUserGQL, LoginMeQuery, LoginMeGQL } from '@generated-types';
import { SEOService } from '@services/seo.service';
import { FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { fas, faCoffee } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
import { fab } from '@fortawesome/free-brands-svg-icons';
import { Observable, Subscription } from 'rxjs';
import { map } from 'rxjs/operators';
@umutyerebakmaz
umutyerebakmaz / user-nav-one.component.html
Created Feb 25, 2020
RouterLinkActiveOptions usage example
View user-nav-one.component.html
<div *ngIf="user" fxLayout="row" fxLayoutAlign="center none">
<div class="user-nav-one mat-elevation-z2" fxLayout="row" fxLayoutAlign="space-between none">
<a mat-button routerLink="/okur/{{ user.slug }}" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Duvar <span>0</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/kitaplari" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Kitapları <span>173</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/takip-ettikleri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Takip Ettikleri <span>971</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/takipcileri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Takipçileri <span>1.362</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/begendikleri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Beğendikleri <span>156</span></a>
<a mat-button rout
@umutyerebakmaz
umutyerebakmaz / user-nav-one.component.html
Created Feb 25, 2020
RouterLinkActiveOptions usage example
View user-nav-one.component.html
<div *ngIf="user" fxLayout="row" fxLayoutAlign="center none">
<div class="user-nav-one mat-elevation-z2" fxLayout="row" fxLayoutAlign="space-between none">
<a mat-button routerLink="/okur/{{ user.slug }}" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Duvar <span>0</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/kitaplari" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Kitapları <span>173</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/takip-ettikleri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Takip Ettikleri <span>971</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/takipcileri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Takipçileri <span>1.362</span></a>
<a mat-button routerLink="/okur/{{ user.slug }}/begendikleri" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">Beğendikleri <span>156</span></a>
<a mat-button rout
@umutyerebakmaz
umutyerebakmaz / array-element-by-index.ts
Created Feb 10, 2020
Get the array element by index
View array-element-by-index.ts
toolTips = ['Kötü', 'Orta', 'İyi', 'Çok İyi', 'Mükemmel'];
getTooltip(index: number): string {
return this.toolTips[index];
}
<button mat-icon-button
*ngFor="let ratingId of ratingArr; index as i" [id]="'star_'+i"
(click)="onClick(i+1)"
[matTooltip]="getTooltip(ratingId)"
matTooltipPosition="above">
View author-page.html
<div class="author-up container" fxLayoutAlign="row" *ngIf="author">
<div class="image-area" *ngIf="author.image !== null">
<img src="http://localhost:4000/images/authors/{{ author.image }}" alt="{{ author.title }}">
</div>
<div class="image-area" *ngIf="author.image === null">
<img class="author-default-image" src="http://localhost:4000/images/authors/default-author.png"
alt="Author Default Image">
</div>
View user-author-like.resolver.ts
import { Resolver, Authorized, Mutation, Arg } from 'type-graphql';
import { UserAuthorLike } from './user-author-like.entity';
@Resolver()
export class UserAuthorLikeResolver {
@Authorized('ADMIN', 'MODERATOR', 'MEMBER')
@Mutation(() => Boolean)
async yazarBegen(
@Arg('userId') userId: string,
@umutyerebakmaz
umutyerebakmaz / user-author-like.entity.ts
Created Jan 17, 2020
TypeORM ManyToMany Kullanımı.
View user-author-like.entity.ts
import { BaseEntity, PrimaryColumn, Entity, CreateDateColumn } from 'typeorm';
@Entity()
export class UserAuthorLike extends BaseEntity {
@PrimaryColumn('uuid')
userId: string;
@PrimaryColumn('uuid')
authorId: string;
@umutyerebakmaz
umutyerebakmaz / author.entity.ts
Created Jan 17, 2020
TypeORM ManyToMany Kullanımı.
View author.entity.ts
import { Entity, PrimaryGeneratedColumn, Column, BaseEntity, ManyToMany } from 'typeorm';
import { ObjectType, Field, ID } from 'type-graphql';
import { User } from '../user/user.entity';
@Entity()
@ObjectType()
export class Author extends BaseEntity {
@PrimaryGeneratedColumn("uuid")
@umutyerebakmaz
umutyerebakmaz / user.resolver.ts
Last active Jan 17, 2020
TypeORM ManyToMany Kullanımı.
View user.resolver.ts
import { Resolver, Mutation, Arg } from 'type-graphql';
import { User } from './user.entity';
import { UserAuthorLike } from '../user-author-like/user-author-like.entity';
@Resolver(User)
export class UserResolver {
// yazar beğen
@Mutation(() => Boolean)
async yazarBegen(
@Arg('userId') userId: string,
You can’t perform that action at this time.