Skip to content

Instantly share code, notes, and snippets.

View asilbalaban's full-sized avatar

Asil Balaban asilbalaban

View GitHub Profile
@asilbalaban
asilbalaban / sql.sql
Created November 22, 2017 11:31
Türkçe karakter düzeltme sql
UPDATE users SET fullname = REPLACE (fullname, 'ÅŸ', 'ş' ) WHERE fullname LIKE '%ÅŸ%';
UPDATE users SET fullname = REPLACE (fullname, 'Åž', 'Ş' ) WHERE fullname LIKE '%Åž%';
UPDATE users SET fullname = REPLACE (fullname, 'Ç', 'Ç' ) WHERE fullname LIKE '%Ç%';
UPDATE users SET fullname = REPLACE (fullname, 'ç', 'ç' ) WHERE fullname LIKE '%ç%';
UPDATE users SET fullname = REPLACE (fullname, 'Ã?', 'Ö' ) WHERE fullname LIKE '%Ã?%';
UPDATE users SET fullname = REPLACE (fullname, 'Ö', 'Ö' ) WHERE fullname LIKE '%Ö%';
UPDATE users SET fullname = REPLACE (fullname, 'ö', 'ö' ) WHERE fullname LIKE '%ö%';
UPDATE users SET fullname = REPLACE (fullname, 'ü', 'ü' ) WHERE fullname LIKE '%ü%';
UPDATE users SET fullname = REPLACE (fullname, 'ÄŸ', 'ğ' ) WHERE fullname LIKE '%ÄŸ%';
UPDATE users SET fullname = REPLACE (fullname, 'ı', 'ı' ) WHERE fullname LIKE '%ı%';
@asilbalaban
asilbalaban / vagrant-django.md
Last active March 11, 2017 21:47
vagrant üzerinden django çalıştırmak

Vagrantfile içerisinde yapılacak ayarlar

config.vm.network "forwarded_port", guest: 8000, host: 8001
config.vm.hostname = "proje.dev"

ayar değişikliklerinden sonra

vargrant reload ile vagrantın değişiklikleri görmesini sağlayın.

Composer
"laravelcollective/html": "5.3.*"
Service Provider
Collective\Html\HtmlServiceProvider::class,
Aliases
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
@asilbalaban
asilbalaban / osx-update-fix.shell
Created December 16, 2016 08:10
If your localhost broken after MacOS update...
sudo mv /private/etc/apache2/httpd.conf~previous /private/etc/apache2/httpd.conf
sudo mv /private/etc/apache2/extra/httpd-vhosts.conf~previous /private/etc/apache2/extra/httpd-vhosts.conf
sudo apachectl restart
@asilbalaban
asilbalaban / shell.md
Last active September 29, 2016 09:15
Cpanel Directories

Apache .conf files httpd.conf

/usr/local/apache/conf

Apache log files

/usr/local/apache/logs/

Virtual Host

/var/cpanel/userdata/USERNAME/DOMAIN.COM
/scripts/rebuildhttpdconf
Sunucunuzu DigitalOcean‘da barındırıyorsanız ve Hosting yönetimi için zpanel kullanıyorsanız. Droplet imaj yedeğini aldıktan sonra bu sorunla karşılaşabilirsiniz. Veya başka bir sebeple bu hatayla karşılaşabilirsiniz.
`Critical Error: [0100] - Unable to connect or authenticate
to the ZPanel database (zpanel_core).
We advice that you contact the server administrator to ensure
that the database server is online and that the correct
connection parameter are being used.`
Sorun mysql servisinin başlatılamamasından kaynaklanıyor.
@asilbalaban
asilbalaban / mail.php
Created September 17, 2016 09:07
laravel gmail setup
<?php
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
@asilbalaban
asilbalaban / loop.php
Created September 17, 2016 09:06
loop like wordpress
<?php
header('Content-Type: text/html; charset=utf-8');
///////////////////////Fonksiyonlar\\\\\\\\\\\\\
function havePosts()
{
global $currentPost;
if (!isset($currentPost)) {
@asilbalaban
asilbalaban / recursive file delete.php
Created September 17, 2016 09:05
İçi dolu klasörleri klasörle beraber silmek için yazılmış sorunsuz çalışan bir fonksiyon
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
@asilbalaban
asilbalaban / cache-function.php
Created September 17, 2016 09:04
Geçen gün bir arkadaşımın sitesi üzerinde düzenleme yaparken ufak bir cache sistemi yazmam gerekti. Dosya tabanlı bir cache fonksiyonu hazırladım. SQL sorgunuzu fonksiyona gönderin. Eğer cache varsa cache’den bilgi versin, yoksa db üzerinden veriyi alıp cache’leyip geri versin.
function select ( $query )
{
$cacheFile = md5($query).'.html';
$dizin = $cacheFile[0];
if ( !file_exists ( SITE_PATH.'cache/'.$dizin ) )
{
mkdir(SITE_PATH.'cache/'.$dizin, 0777, true);
}