Skip to content

Instantly share code, notes, and snippets.

Avatar
💬
I'm using skype, see you again.

umut yerebakmaz umutyerebakmaz

💬
I'm using skype, see you again.
View GitHub Profile
View example.ts
export const deleteProduct = async (req, res, next) => {
const response = await productModel.findByIdAndRemove(req.params.productId);
if (!response) {
return next(res.status(200).json({
success: false,
message: 'ürün bulunamadı'
}));
}
else return next(res.status(200).json({
success: true,
@umutyerebakmaz
umutyerebakmaz / typeorm-conditional-query.resolver.ts
Last active Jan 26, 2021
Example of conditional dynamic query technique based on parameter conditions in TypeORM. .where. .andWhere .andWhereIds
View typeorm-conditional-query.resolver.ts
@Authorized()
@Query(() => [Coordinate])
async coordinates(
@Arg('filter') filter: CoordinateFilterInput,
): Promise < Coordinate[] > {
console.log(filter);
const query = await getConnection().createQueryBuilder(Coordinate, 'coordinate');
@umutyerebakmaz
umutyerebakmaz / border.scss
Created Jan 11, 2021
An example zero error to add infinite dynamic border box
View border.scss
.used-biocidal-box {
border: 1px solid #dddfe2;
padding: 10px 10px;
font-family: 'SF UI Display', sans-serif;
font-size: 14px;
}
.used-biocidal-box:not(:first-child) {
border-top: none;
}
@umutyerebakmaz
umutyerebakmaz / current.component.html
Last active Dec 30, 2020
How to Use Custom SVG Icons in Angular Material
View current.component.html
<mat-icon svgIcon="marker" [ngStyle]="{ 'color': 'red' }">marker</mat-icon>
View tsconfig.json
{
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["esnext", "esnext.asynciterable"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
@umutyerebakmaz
umutyerebakmaz / shoping-cart.js
Created Oct 22, 2020
pure javascript shoping cart
View shoping-cart.js
// variables
const cartBtn = document.querySelector(".cart-btn");
const closeCartBtn = document.querySelector(".close-cart");
const clearCartBtn = document.querySelector(".clear-cart");
const cartDOM = document.querySelector(".cart");
const cartOverlay = document.querySelector(".cart-overlay");
const cartItems = document.querySelector(".cart-items");
const cartTotal = document.querySelector(".cart-total"); // cart totals
const cartContent = document.querySelector(".cart-content");
// const productsDOM = document.querySelector(".products-center");
View sms.ts
import Nexmo from 'nexmo';
export function sendSms(sender: string, recepient: string, message: string): void {
const nexmo = new Nexmo({
apiKey: '****',
apiSecret: '*****',
});
// const sender = 'Vonage APIs';
// const recepient = '****';
@umutyerebakmaz
umutyerebakmaz / app.routing.module.ts
Last active Oct 5, 2020
Angular 10 brings authorization feature to routes according to specified authorizations. It is a simple example that supports multiple roles.
View app.routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthorizedUserRouteGuard } from '@guards/authorized-user-route.guard';
import { AuthRouteGuard } from '@guards/auth-route.guard';
const routes: Routes = [
{
path: 'admin/depos',
loadChildren: () => import('@app/modules/admin/depos/depos.module').then(m => m.DeposModule),
canActivate: [AuthRouteGuard],
View startWith.ts
startWith(str: string, url: string): boolean {
const patt = new RegExp('(' + str +')');
const res = patt.test(url);
return res;
}
this.startWith('/admin/depos/update', event.url)
// str: '/admin/depos/update'
// event.url: /admin/depos/update/3016599b-f0a1-4520-b42b-7f234a008849
@umutyerebakmaz
umutyerebakmaz / postgres.config
Created Sep 25, 2020
Postgres Data Transfer Notes
View postgres.config
// tabloları senkronize et. function olarak uuid-ossp ekle.
// transfer ekranında diğer functionları pas geç.
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";