Skip to content

Instantly share code, notes, and snippets.

View bariscanyilmaz's full-sized avatar
😃
I like computers

Barış Can Yılmaz bariscanyilmaz

😃
I like computers
View GitHub Profile

Hello World

@bariscanyilmaz
bariscanyilmaz / index.js
Last active March 31, 2019 16:00
Socket.io ve Canvas ile örnek realtime uygulama
const express=require('express');
const app = express();
const http = require('http').Server(app);
const io = require('socket.io')(http);
const balls = [];
app.use(express.static(__dirname+'/public'))
app.get('/', function (req, res) {
@bariscanyilmaz
bariscanyilmaz / main.js
Last active March 31, 2019 17:24
scoket.io ve canvas ile gerçek zamanlı uygulama örneği main.js
var btnJoin;
var socket = io.connect('http://localhost:3000/');
socket.on('newBall', function (data) {
addBall(data);
});
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Category } from '../models/category.model';
@Injectable({
providedIn: 'root'
})
export class CategoryService {
constructor(private fireStore: AngularFirestore) {
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Injectable } from '@angular/core';
import { Book } from "../models/book.model";
import { Category } from '../models/category.model';
@Injectable({
providedIn: 'root'
})
export class BookService {
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { BookService } from './services/book.service';
import { Book } from './models/book.model';
import { CategoryService } from './services/category.service';
import { Category } from './models/category.model';
import { SwalComponent } from '@sweetalert2/ngx-sweetalert2';
import { MatDialog } from '@angular/material/dialog';
import { BookDialogComponent } from './components/book-dialog/book-dialog.component';
import { AddbookDialogComponent } from './components/addbook-dialog/addbook-dialog.component';
import { AddcategoryDialogComponent } from './components/addcategory-dialog/addcategory-dialog.component';
<div class="container">
<div class="category-list">
<mat-button-toggle-group #categoryGroup="matButtonToggleGroup">
<mat-button-toggle [value]="category.Name" *ngFor="let category of categories">
{{category.Name}}
</mat-button-toggle>
</mat-button-toggle-group>
</div>
<div mat-dialog-content class="book-dialog-content">
<form [formGroup]="addBookForm" class="add-book-form">
<mat-form-field>
<input formControlName="bookName" matInput placeholder="Book Name" required >
</mat-form-field>
<mat-form-field>
<input matInput formControlName="bookAuthor" placeholder="Book Author" required>
</mat-form-field>
import { Component, OnInit, Inject } from '@angular/core';
import { FormGroup, FormBuilder, FormControl, FormArray } from '@angular/forms';
import { Category } from 'src/app/models/category.model';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { BookService } from 'src/app/services/book.service';
import { Book } from 'src/app/models/book.model';
@Component({
selector: 'app-addbook-dialog',
templateUrl: './addbook-dialog.component.html',
<div class="book-form-categories" formArrayName="bookCategories"
*ngFor="let item of addBookForm.get('bookCategories')['controls']; let i = index;">
<mat-form-field [formGroupName]="i" class="book-form-category">
<mat-label>Book Category</mat-label>
<mat-select formControlName="bookCategory" required>
<mat-option *ngFor="let category of data" [value]="category.Name">
{{category.Name}}
</mat-option>
</mat-select>
</mat-form-field>