Skip to content

Instantly share code, notes, and snippets.

View asilbalaban's full-sized avatar

Asil Balaban asilbalaban

View GitHub Profile
@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);
}
@asilbalaban
asilbalaban / apache-remove-ssl-passphare.md
Last active September 16, 2016 15:08
Apache her restart edildiğinde SSL kullandığınız için passphare girmenizi istiyorsa ve bunu kaldırmak istiyorsanız aşağıdaki komutu kullanabilirsiniz.

Apache her restart edildiğinde SSL kullandığınız için passphare girmenizi istiyorsa ve bunu kaldırmak istiyorsanız aşağıdaki komutu kullanabilirsiniz.

Öncelikle serfitikaların olduğu dizine gidin ve aşağıdaki komutu dosya adına göre düzenleyip çalıştırın.

openssl rsa -in sitecom.key -out sitecom.key.nopass

Şimdi şifre sormayan bir key dosyası oluşturdunuz. Apache Virtualhost ayarlarına giderek key dosyasını yeni dosya ile düzenleyin

SSLCertificateKeyFile /root/ssl/sitecom/sitecom.key.nopass

@asilbalaban
asilbalaban / bootstrap responsive jquery detection
Created September 14, 2016 08:45
bootstrap responsive breakpoints detector
function responsive ()
{
if ($(window).width() < 768) {
console.log('xs');
}
else if ($(window).width() >= 768 && $(window).width() <= 992) {
console.log('sm');
}
else if ($(window).width() > 992 && $(window).width() <= 1200) {
console.log('md');
@asilbalaban
asilbalaban / zpanel.sh
Created September 14, 2015 17:12
zpanel deamon restart from terminal
php -q /etc/zpanel/panel/bin/daemon.php
@asilbalaban
asilbalaban / remove.sh
Created April 14, 2015 21:03
remove osx dot files and .DS_Store on ubuntu server
find . -name ._\* -print0 | xargs -0 rm -f
find . -name .DS_Store -printf \"%p\"\ \ | xargs rm
@asilbalaban
asilbalaban / gist:2720a789a6999f9cecc5
Last active August 29, 2015 14:18
apache2 virtual host oluşturma
sudo mkdir /var/www/denkarsport.com
sudo chown www-data:www-data /var/www/denkarsport.com/ -R
sudo chmod 755 -R /var/www/denkarsport.com
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/denkarsport.com.conf
sudo nano /etc/apache2/sites-available/denkarsport.com.conf
ServerName denkarsport.com
ServerAlias www.denkarsport.com
@asilbalaban
asilbalaban / instagram.php
Last active August 29, 2015 14:16
with this script you can get latest instagram pictures of any user without auth
<?php
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
@asilbalaban
asilbalaban / bulten.txt
Created March 2, 2015 14:36
dandik e-bulten kayit php
test@example.com
object-fit: fill;
/* Do not scale the image */
object-position: center;
/* Center the image within the element */
width: 100%;
height: 200px !important;
max-height: 200px !important;
@asilbalaban
asilbalaban / setup.md
Created January 14, 2015 16:00
How to install fuelphp and setup ormauth on it!

Installing and Setup FuelPHP's Ormauth

Create new project with Oil

$ oil create <project_name>

In your project there is a fuel/packages folder Copy /fuel/packages/auth/config/auth.php and /fuel/packages/auth/config/ormauth.php files to your main config folder which is /fuel/app/config/