Skip to content

Instantly share code, notes, and snippets.

@ozkanozcan
ozkanozcan / remove .DS_Store
Created March 2, 2024 21:42
remove .DS_Store from git repository
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
echo .DS_Store >> .gitignore
git add .gitignore
git commit -m '.DS_Store dosyaları kaldırıldı!'
@ozkanozcan
ozkanozcan / Amazon_CORS_sample.txt
Created February 14, 2024 19:57
Amazon CORS json sample
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"HEAD",
"PUT",
"POST",
@ozkanozcan
ozkanozcan / tax_validation.php
Created December 26, 2023 18:40 — 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
{
@ozkanozcan
ozkanozcan / popup_once.php
Last active March 2, 2024 21:43
siteye ilk girince sadece 1 defa açılan popup kodu.
Bu işlem için farklı yöntemler kullanılabilir ancak en yaygın yöntemlerden biri, kullanıcının siteye ilk girdiğinde bir cookie oluşturarak ve modal'ın yalnızca cookie mevcut olmadığında gösterilmesini sağlamaktır.
İşlem adımları aşağıdaki gibi olabilir:
İlk olarak, modal'ın açılıp açılmadığını kontrol eden bir koşul oluşturun. Bu koşul, genellikle bir JavaScript fonksiyonu içinde yer alır.
Daha sonra, cookie'nin var olup olmadığını kontrol eden bir fonksiyon yazın. Eğer cookie mevcut değilse, modal'ı açmak için koşulu true yapın ve ayrıca cookie'yi oluşturun.
Eğer cookie varsa, koşulu false yaparak modal'ın açılmamasını sağlayın.
@ozkanozcan
ozkanozcan / Bootstrap4-Tiers.txt
Created September 17, 2022 23:14
Bootstrap 4 Hidden & Visible
How Responsive Display Works in Bootstrap 4 Beta
// Extra small devices (portrait phones, less than 576px)
default (max-width: 575px)
// Small devices (landscape phones, 576px and up)
(sm) small (min-width: 576px) and (max-width: 767px)
// Medium devices (tablets, 768px and up)
@ozkanozcan
ozkanozcan / htaccess-301-redirect-samples.txt
Created April 3, 2022 10:52
htaccess 301 redirect samples
# Non-www to www URLs 301 Redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ozkanozcan.com$
RewriteRule (.*) http://www.ozkanozcan.com/$1 [R=301,L]
</IfModule>
# www to non-www URLs 301 Redirect
<IfModule mod_rewrite.c>
RewriteEngine On
@ozkanozcan
ozkanozcan / cookie-policy-confirmation-div.html
Created February 22, 2022 07:05
Cookie Policy Confirmation
@ozkanozcan
ozkanozcan / caption-to-div.php
Created January 23, 2022 10:29
Convert Wordpress caption tag to html div tag
function convert_caption($content)
{
return preg_replace(
'/\[caption([^\]]+)align="([^"]+)"\s+width="(\d+)"\](\s*\<img[^>]+>)\s*(.*?)\s*\[\/caption\]/i',
'<div\1style="width: \3px" class="wp-caption \2">\4<p class="caption">\5</p></div>',
$content);
}
@ozkanozcan
ozkanozcan / .htaccess
Created January 6, 2022 18:24
Setup An .Htaccess File For Redirecting To Laravel’s Public Folder
<IfModule mod_rewrite.c>
# That was ONLY to protect you from 500 errors
# if your server did not have mod_rewrite enabled
RewriteEngine On
# RewriteBase /
# NOT needed unless you're using mod_alias to redirect
RewriteCond %{REQUEST_URI} !/public
RewriteRule ^(.*)$ public/$1 [L]
public static function slugify($text, string $divider = '-')
{
// replace non letter or digits by divider
$text = preg_replace('~[^\pL\d]+~u', $divider, $text);
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);