Skip to content

Instantly share code, notes, and snippets.

@moogii
moogii / api.ts
Created August 8, 2021 16:50
Axios based Next js client and server side token refresher
import axios, { AxiosError } from "axios";
import { GetServerSidePropsContext } from "next";
import Router from "next/router";
const isServer = () => {
return typeof window === "undefined";
}
let accessToken = "";
let context = <GetServerSidePropsContext>{};
@cagcak
cagcak / turkish_NumberToWords.js
Created September 29, 2019 09:27
A function that converts a number to words in Turkish
const turkish_NumberToWords = (number = 0) => {
/*
* Assign spelling words in seperate arrays
*/
const steps = ['', 'bir', 'iki', 'üç', 'dört', 'beş', 'altı', 'yedi', 'sekiz', 'dokuz']
const tens = ['', 'on', 'yirmi', 'otuz', 'kırk', 'elli', 'altmış', 'yetmiş', 'seksen', 'doksan']
const hundreds = ['', 'yüz', 'ikiyüz', 'üçyüz', 'dörtyüz', 'beşyüz', 'altıyüz', 'yediyüz', 'sekizyüz', 'dokuzyüz']
const nS = ['', 'bin', 'milyon', 'milyar', 'trilyon', 'katrilyon', 'kentilyon', 'seksilyon', 'septilyon', 'oktilyon']
/*
* Maximum number step is 30
@burakerdem
burakerdem / turkey_cities_counties.sql
Created July 22, 2013 14:04
City and county list in Turkey with lat/lng.
DROP TABLE IF EXISTS `cities`;
CREATE TABLE `cities` (
`id` int(2) NOT NULL,
`title` varchar(255) NOT NULL,
`lat` double(11,8) DEFAULT NULL,
`lng` double(11,8) DEFAULT NULL,
`northeast_lat` double(11,8) DEFAULT NULL,
`northeast_lng` double(11,8) DEFAULT NULL,
`southwest_lat` double(11,8) DEFAULT NULL,
`southwest_lng` double(11,8) DEFAULT NULL,