Skip to content

Instantly share code, notes, and snippets.

View iuzn's full-sized avatar
🟢
I'm getting ready

Ibrahim Uzun iuzn

🟢
I'm getting ready
View GitHub Profile
@iuzn
iuzn / slugify.js
Created March 26, 2022 19:08 — forked from codeguy/slugify.js
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@iuzn
iuzn / Layout.tsx
Created March 30, 2022 12:18
In this example, I tried to show how to manipulate the 'hydration warning' that can be encountered in server-side rendering with React. Since the HTML code will match exactly on the server and client sides, such a warning will no longer appear.
import { useRouter } from 'next/router'
import React, { useEffect, useState } from 'react'
import type { PropsWithChildren } from 'react'
interface MenuProps {
title: string
path: string
}
@iuzn
iuzn / awesome-chatgpt-prompt.md
Last active December 2, 2023 08:32
A shortcut to quickly set ChatGPT to the desired role.

I want you to act as a prompt generator. Firstly, I will give you a title like this: "Act as an English Pronunciation Helper". Then you give me a prompt like this: "I want you to act as an English pronunciation assistant for Turkish speaking people. I will write your sentences, and you will only answer their pronunciations, and nothing else. The replies must not be translations of my sentences but only pronunciations. Pronunciations should use Turkish Latin letters for phonetics. Do not write explanations on replies. My first sentence is "how the weather is in Istanbul?"." (You should adapt the sample prompt according to the title I gave. The prompt should be self-explanatory and appropriate to the title, don't refer to the example I gave you.). My first title is "Act as a Code Review Helper" (Give me prompt only)