Skip to content

Instantly share code, notes, and snippets.

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
View human-readable-date.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';
import 'moment/locale/tr';
@Pipe({
name: 'humanReadableDate',
})
export class HumanReadableDatePipe implements PipeTransform {
transform(date: Date) {
const now = moment();
@umutyerebakmaz
umutyerebakmaz / datetime-difference-detector.ts
Last active March 15, 2023 13:51
datetime-difference-detector.ts
View datetime-difference-detector.ts
const now = new Date();
const scheduledDate = new Date(this.element.scheduledDate);
const diff = scheduledDate.getTime() - now.getTime();
diff < 0 ? (this.showWarningColor = true) : (this.showWarningColor = false);
@umutyerebakmaz
umutyerebakmaz / foo.entity.ts
Last active March 8, 2023 11:21
Using @FieldResolver
View foo.entity.ts
@Entity()
@ObjectType()
export class Foo extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
@Field(() => ID)
id: string;
@Column()
@Field()
title: string;
@umutyerebakmaz
umutyerebakmaz / slider.blade.php
Created December 19, 2022 13:13
Carousel Slider with Progress Bar Indicator (JavaScript, AlpineJS, TailwindCSS, Laravel Blade Component)
View slider.blade.php
<div id="slider" class="relative flex-col justify-center items-center pt-5" x-data="slider(6000)">
<div class="relative overflow-hidden rounded shadow">
<!-- progress bar -->
<div id="slider-progress-bar" class="block h-4 bg-indigo-400"></div>
<!-- item 1 -->
<div x-show="active === 1" data-slider-item>
<div class="text-white font-bold absolute text-4xl bottom-1 right-1">1 / 3</div>
<img src="https://images.unsplash.com/photo-1438761681033-6461ffad8d80?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1520&q=80"
loading="lazy" alt="">
<div class="text-white font-bold absolute text-4xl bottom-1 left-1">Caption Text 1</div>
@umutyerebakmaz
umutyerebakmaz / refetch.ts
Last active October 17, 2022 12:19
Creating conditional Apollo Client RefetchQueries parameter in Angular applications
View refetch.ts
refetchHander(appState: AppState): MutationBaseOptions {
const refetchQueries = [
{
query: this.coordinatesTableGQL.document,
variables: {
filter: {
skip: 0,
take: 10,
},
},
@umutyerebakmaz
umutyerebakmaz / avoid-border-conflict.scss
Last active August 26, 2022 13:31
My TailwindCSS examples
View avoid-border-conflict.scss
.wrapper {
@apply overflow-hidden shadow ring-1 ring-black ring-opacity-5 rounded-lg;
}
.item {
@apply bg-white;
}
.item:not(:nth-child(1)) {
@apply border-t border-gray-200;
View Payfor3D.php
<?php
namespace App\Classes;
class Payfor3D
{
public string $MbrId = '5';
public string $MerchantID = '085300000009704';
public string $MerchantPass = '12345678';
public string $UserCode = 'QNB_API_KULLANICI_3DPAY';
View eslintrc.json
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
View gist:885a8b66894867e29c021b8c42b3e1fb
const temp = this.employees.filter(employee => {
return this.departments.find(department => department.id == employee.departmentId)
}).reduce((mem: any, cur: any) => {
mem[cur.departmentId] = (mem[cur.departmentId] || 0) + 1;
console.log(mem);
return mem;
}, {});
const calculate = Object.keys(temp).map(key => ({
departmentId: key,
@umutyerebakmaz
umutyerebakmaz / ShoppingCartController.php
Last active December 30, 2021 12:36
Laravel 8 Advanced Shopping Cart, Sub Total, Grand Total, Calculate Dynamic Freight Rate Price, Add , Remove, Clear, Remove Selected
View ShoppingCartController.php
<?php
namespace App\Http\Controllers;
use App\Models\FreightRate;
use App\Models\ShoppingCart;
use App\Models\ShoppingSession;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;