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;
@ferdiunal
ferdiunal / array2json.php
Last active June 27, 2023 00:54
Ülkelerin İl, İlçeleri. Şimdilik Türkiye'yi ekleyebildim.
#!/usr/bin/env php
<?php
/**
* @author Ferdi ÜNAL
* @email ferdi@unal.pw
*/
$location = require "location.php";
$json = fopen('location.json', 'w');
@charset "UTF-8";
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--header-height: 72px;
}
[
{
"il": "Adana",
"plaka": 1,
"ilceleri": [
"Aladağ",
"Ceyhan",
"Çukurova",
"Feke",
"İmamoğlu",
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 / tax_validation.php
Last active August 4, 2021 12:21 — forked from emir/tax_validation.php
PHP Vergi Numarası Doğrulama
<?php
/**
* This method logically validates Turkish VAT number
*
* @param string $taxNumber
* @return bool
*/
public function validateTaxNumber(string $taxNumber): bool
{
@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,