Skip to content

Instantly share code, notes, and snippets.

View tayfunerbilen's full-sized avatar
🙉
busy for earthly things

Tayfun Erbilen tayfunerbilen

🙉
busy for earthly things
View GitHub Profile
[
{ "name": "Afghanistan", "code": "AF" },
{ "name": "Åland Islands", "code": "AX" },
{ "name": "Albania", "code": "AL" },
{ "name": "Algeria", "code": "DZ" },
{ "name": "American Samoa", "code": "AS" },
{ "name": "AndorrA", "code": "AD" },
{ "name": "Angola", "code": "AO" },
{ "name": "Anguilla", "code": "AI" },
{ "name": "Antarctica", "code": "AQ" },
@tayfunerbilen
tayfunerbilen / replaceEnvVariables.js
Created April 13, 2023 15:54
CRA uygulamanızı Vite'e geçirirken env kullanılan yerleri otomatik olarak Vite'e uygun hale getiren nodejs betiği
const fs = require("fs");
const path = require("path");
// Değişiklik yapılacak olan dosya uzantıları
const fileExtensions = [".js", ".jsx"];
// Analiz edilecek olan dizinler
const sourceDirectories = ["src"];
// Dizinlerdeki tüm dosyaları listeleme
@tayfunerbilen
tayfunerbilen / updateImportPaths.js
Created April 13, 2023 15:49
RA'dan Vite'e geçerken path'leri Vite'e göre ayarlamak için gerekli betik, relative path'lerin başına ~/ koyar, farklı bir ayar yaptıysanız betik içinden karakteri değiştirebilirsiniz
const fs = require("fs");
const path = require("path");
// Değişiklik yapılacak olan dosya uzantıları
const fileExtensions = [".js", ".jsx"];
// Analiz edilecek olan dizinler
const sourceDirectories = ["src"];
// Yeni başlangıç karakteri
@tayfunerbilen
tayfunerbilen / changeJsxExtensions.js
Created April 13, 2023 10:39
React CRA projelerinizi Vite'e gecirirken .js uzantili jsx dosyalarinizi .jsx uzantisina ceviren nodejs betigi
const fs = require('fs');
const path = require('path');
const directoryPath = path.join(__dirname, 'src');
function isJSX(fileContent) {
const jsxElementRegex = /<[\w\s.:]+\/?>/; // Basit JSX elementlerini kontrol etmek için düzenli ifade
const reactComponentRegex = /import.*from\s+['"]react(-router-dom|-icomoon)?['"]/; // React, react-router-dom ve react-icomoon içe aktarımını kontrol etmek için düzenli ifade
const reactElementRegex = /<\w+(\s+\w+(\s*=\s*{[^}]*}|"[^"]*"|'[^']*'))*\s*\/?>/; // Karmaşık JSX elementlerini kontrol etmek için düzenli ifade
const capitalizedFunctionComponentRegex = /function\s+[A-Z]\w*\s*\(/; // Fonksiyon bileşeni için düzenli ifade
@tayfunerbilen
tayfunerbilen / 00-README-NEXT-SPA.md
Created March 24, 2023 13:28 — forked from gaearon/00-README-NEXT-SPA.md
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@tayfunerbilen
tayfunerbilen / rozet.sql
Created March 18, 2023 17:32
Rozet sistemi, kullanıcının puanına göre otomatik rozetlerini tanımlayan ve bildirim gönderen sistem
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
@tayfunerbilen
tayfunerbilen / php-instagram-info.php
Created February 14, 2023 11:25
instagram kullanici bilgileri ve son postlari alan kod
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://www.instagram.com/' . $_GET['username'] . '/embed/',
CURLOPT_USERAGENT => 'Mozilla/5.0 (Linux; Android 6.0.1; SM-G935S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36',
CURLOPT_RETURNTRANSFER => true
]);
$output = curl_exec($ch);
curl_close($ch);
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@tayfunerbilen
tayfunerbilen / gist:57b86eebe5e8663ec274f64812dd0647
Created October 10, 2018 15:03 — forked from burakerdem/gist:1007450
PHP: ucwords() for UTF-8 strings
<?php
if (!function_exists('mb_ucwords'))
{
function mb_ucwords($str)
{
return mb_convert_case($str, MB_CASE_TITLE, "UTF-8");
}
}
@tayfunerbilen
tayfunerbilen / php-array-cut.php
Last active April 15, 2018 09:21
PHP Array Cut
<?php
$array = array(
'a' => 1,
'ab' => 2,
'ba' => 3,
'ca' => 4,
'ac' => 5,
5 => 6,
6 => 7,