Skip to content

Instantly share code, notes, and snippets.

View adililhan's full-sized avatar

adililhan

View GitHub Profile
<?php
// Iki zaman arasinda 10 dk atlayarak veri olusturma
$hourRange = range(strtotime('00:00'), strtotime('23:50'), 10 * 60);
foreach($hourRange as $time){
$date = date("H:i",$time);
echo $date . "\n";
}
@adililhan
adililhan / Post.php
Created November 13, 2014 21:28
Doctrine 2'de örnek @Version annotation'ının kullanımı
<?php
namespace Acme\BlogBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Post
*
* @ORM\Table()
@adililhan
adililhan / gist:1962454
Created March 2, 2012 23:43
Döviz bilgileri
#!/usr/bin/env python
#-*-coding: utf-8-*-s
__author__ = "Adil Ilhan"
import requests
import re
class VeriCek(object):
def __init__(self):
@adililhan
adililhan / gist:3159594
Created July 22, 2012 13:05
ompldr.org'a dosya yükler ve yüklenen dosyayı bilgisayardan siler.
#!/usr/bin/env ruby
#
# Copyright 2007-2009 David Shakaryan <omp@gentoo.org>
# Copyright 2007-2009 Brenden Matthews <brenden@diddyinc.com>
# Copyright 2010 Murilo Soares Pereira <murilo.soares3@gmail.com>
#
# Distributed under the terms of the GNU General Public License v3
#
# Special thanks to Christoph for a patch.
@adililhan
adililhan / awesome-php.md
Created September 20, 2012 07:47 — forked from sineld/awesome-php.md
Awesome PHP Libraries
@adililhan
adililhan / Polimorfizm.java
Created October 9, 2012 18:41
Java'da polimorfizm örneği
interface Telefon{
public String TelefonEt(String TelNo);
}
class CepTelefonu implements Telefon {
private boolean kontorVarMi = true;
private boolean operatorUygunMu = false;
@Override
@adililhan
adililhan / named_capturing.php
Created November 17, 2012 19:12
RegEx'de Named Capturing Groups Örneği
<?php
$str = "ayva araba masa kitap defter 12 4378564 aslan";
preg_match_all('/(?P<rakamlar>[0-9]+)/', $str, $matches);
print_r ($matches);
@adililhan
adililhan / Late_Static_Binding.php
Created November 22, 2012 21:27
Late Static Binding Örneği
<?php
class X {
public static function Z(){
return "X çağırıldı\n";
}
public function getSelfZ(){
echo self::Z(); // X sinifindaki deger doner
}
@adililhan
adililhan / ClosureTest.php
Created June 13, 2013 19:45
PHP'de sınıf içinde bulunan closure fonksiyondan üye metota erişmeyi sağlayan kod.
<?php
class ClosureTest {
public $getInfo;
public function __construct() {
$that = $this; // Yerel degisken olusturuldu (local variable)
$this->getInfo = function() use($that) {
@adililhan
adililhan / ClosureTest.php
Created June 13, 2013 19:55
PHP'de sınıf içinde bulunan closure fonksiyondan üye metota erişirken PHP 5.3'te Fatal Error veren kod.
<?php
class ClosureTest {
public $getInfo;
public function __construct() {
$this->getInfo = function() {
$this->getCity(); // Bu satir PHP 5.3'te Fatal Error verecektir.
return 'Ben şehir bilgisini getiren metottan sonra çağırıldım.';