Skip to content

Instantly share code, notes, and snippets.

View ferdiunal's full-sized avatar
🏠
Working from home

Ferdi ÜNAL ferdiunal

🏠
Working from home
View GitHub Profile
@ferdiunal
ferdiunal / useUndo.ts
Created February 17, 2024 15:26 — forked from KristofferEriksson/useUndo.ts
A React hook that enhances your components with powerful undo/redo functionality
import { useCallback, useEffect, useRef, useState } from "react";
interface UseUndoHook<T> {
value: T;
onChange: (newValue: T) => void;
undo: () => void;
redo: () => void;
clear: () => void;
canUndo: boolean;
canRedo: boolean;
import { ethers } from "ethers";
import { RuntimeError } from "../errors";
interface NetworkConfig {
chainId: string;
rpcUrls: string[];
chainName: string;
nativeCurrency: {
name: string;
symbol: string;
@charset "UTF-8";
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--header-height: 72px;
}
func (u *UserHandlers) CreateUser(c *fiber.Ctx) error {
errors := ValidateErrorResponse{}
errors.Errors = make(library.ValidateError)
user := models.User{}
v := validator.New()
body := new(CreateUserBody)
if err := c.BodyParser(body); err != nil {
return c.Status(422).JSON(
@ferdiunal
ferdiunal / upload.component.ts
Created May 14, 2021 08:17 — forked from kkbalu/upload.component.ts
Vimeo video uploader using tus js client
//Filename: upload.component.ts
import { Component, OnInit } from '@angular/core';
import { UploadService } from '../upload.service';
import { map, expand } from 'rxjs/operators';
import { EMPTY } from 'rxjs';
export class uploadFiles {
constructor(public video: File, public path: string, public uploadURI: string) {
this.video = video;
this.path = path;
{
"compilerOptions": {
"baseUrl": "src",
"paths": {
"~/*": [
"*"
]
},
"allowJs": true,
"allowSyntheticDefaultImports": true,
@ferdiunal
ferdiunal / !NOTE.md
Created April 7, 2020 10:05 — forked from mehranhadidi/!NOTE.md
Setup a Laravel Storage driver with Google Drive API
@ferdiunal
ferdiunal / sse.go
Created September 5, 2019 20:16 — forked from ismasan/sse.go
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
-----BEGIN RSA PRIVATE KEY-----
MIIJJgIBAAKCAgBoe2f+iDWW+xMsnKeL31ZRxPw0Gvj8Eku8MTWkFwISRF7vwepx
JWHGs2Ud/v7BZwh+aPlhp32n5JI431/XW/BFcGk3bS3tYkUBEP+cpwWJe9UDaQwN
wF3eg4WWb6BEPerOiWKUxcjz4MKG7Bw6erx4VxjxBGDBXOELZnP9G3LrnMujKoTC
Rig3Ffug3Pclr5bu04wtZ83sGZT2KX1qszwBX9kT0dOd3tAk4HmU0Kq95lc30pNA
zvJ01SfMlaolQ0YCkK1Bqe3d9HqNnv0zNILtJzNGZKJSos4iJPv+nAdwEQXVZWNt
wwdhnHLDwhMo9WKqnONTou8xKisIZfnkznb1bTAEZh/axAsVVertKQ+HryDtM+xC
PWpj4OUz0nctcb2CvAYdz+Q+csr4Fsku/8tPELJBX4Z42D1j34zWJa8CZZHIds79
luHHZdOOoLubLWs2tyKJPTirDPOPspp8uESDTDOIjtH9uIYPD8SgSWeVeBiikelM
VFKYbOmnT1ACYAwpyKOEnxN5BHtIiz6MPxAwIWLJdEduHqm5nAJYBDWgkdepWzMb
try {
$operationLogCount = OperationLog::where('action', self::YEMEK_SEPETI_DISPATCH_TYPE)
->where('type', self::YEMEK_SEPETI_DISPATCH_TYPE)
->where('status', 1)
->where('order_id', $order->id)
->count();
if (count($radiusList) > $operationLogCount) {
$radius = $radiusList[$operationLogCount];
$order->radius = $radius;