Skip to content

Instantly share code, notes, and snippets.

View umutyerebakmaz's full-sized avatar
:octocat:
I'm available, please open an issue on the subject.

Umut Yerebakmaz umutyerebakmaz

:octocat:
I'm available, please open an issue on the subject.
View GitHub Profile
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CanActivateRouteGuardService } from './services/can-activate-route-guard.service';
import { CantActivateRouteGuardService } from './services/cant-activate-route-guard.service';
const routes: Routes = [
{
path: 'login',
loadChildren: './components/login-page/login-page.module#LoginPageModule',
@umutyerebakmaz
umutyerebakmaz / angular-event-list-cheat-sheet.js
Last active December 17, 2019 21:56
Angular 8/9 Event List CheatSheet
# Angular 8 Events Cheet-sheet
(drag)="myFunction()"
(drop)="myFunction()"
(dragover)="myFunction()"
(blur)="someFunction()"
(focus)="someFunction()"
(scroll)="someFunction()"
@umutyerebakmaz
umutyerebakmaz / form.component.ts
Last active December 17, 2019 22:05
Angular 8 Reactive Form input değerini güncellemek.
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.scss']
})
export class FormComponent implements OnInit {
<div *ngIf="user && meQuery$ | async as meQuery" class="reader-up container" fxLayout="row" fxLayoutAlign="space-between">
<div *ngIf="user.id === meQuery.me.id">
<button>PROFİLİMİ GÜNCELLE</button>
</div>
.... other components.....
</div>
ngOnInit() {
this.route.params.subscribe(params => {
this.getUser(params.slug);
});
}
getUser(slug: string) {
this.user$ = this.userPageUserGQL
.watch({ slug: slug }, {
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { UserPageUserQuery, UserPageUserGQL, LoginPageMeQuery, LoginPageMeGQL } from '@generated-types';
import { Observable, Subscription } from 'rxjs';
import { map } from 'rxjs/operators';
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';
<div class="role-badge" [ngClass]="{
'green': user.role === 'ADMIN',
'blue': user.role === 'MODERATOR',
'black': user.role === 'MEMBER'
}">{{ user.role }}</div>
@umutyerebakmaz
umutyerebakmaz / user.entity.ts
Last active January 17, 2020 09:37
TypeORM ManyToMany Kullanımı.
import { Entity,
PrimaryGeneratedColumn,
Column,
BaseEntity,
OneToMany,
CreateDateColumn,
UpdateDateColumn,
ManyToMany,
JoinTable,
OneToOne } from 'typeorm';
@umutyerebakmaz
umutyerebakmaz / author.entity.ts
Created January 17, 2020 09:43
TypeORM ManyToMany Kullanımı.
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-author-like.entity.ts
Created January 17, 2020 09:47
TypeORM ManyToMany Kullanımı.
import { BaseEntity, PrimaryColumn, Entity, CreateDateColumn } from 'typeorm';
@Entity()
export class UserAuthorLike extends BaseEntity {
@PrimaryColumn('uuid')
userId: string;
@PrimaryColumn('uuid')
authorId: string;