Skip to content

Instantly share code, notes, and snippets.

adililhan

  • Ankara
Block or report user

Report or block adililhan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adililhan
adililhan / Post.php
Created Nov 13, 2014
Doctrine 2'de örnek @Version annotation'ının kullanımı
View Post.php
<?php
namespace Acme\BlogBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Post
*
* @ORM\Table()
View date_generator.php
<?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 / DependencyInjection.php
Created Aug 1, 2013
Symfony'nin dependency injection componentinin kullanımını göstermek amacıyla hazırlanmış örnek sınıf.
View DependencyInjection.php
<?php
/**
* Looking for tests DependencyInjectionTest.php
*/
require_once 'vendor/autoload.php';
interface iCurrency {
public function getExchangeRate();
@adililhan
adililhan / DependencyInjectionTest.php
Created Aug 1, 2013
Symfony'nin dependency injection componentinin kullanımını göstermek amacıyla hazırlanmış örnek sınıfın, test sınıfı.
View DependencyInjectionTest.php
<?php
/**
* Tests of DependencyInjection.php
*/
class ControllerTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$this->obj = new Controller;
@adililhan
adililhan / ClosureTest.php
Created Jun 13, 2013
PHP'de sınıf içinde bulunan closure fonksiyondan üye metota erişirken PHP 5.3'te Fatal Error veren kod.
View ClosureTest.php
<?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.';
@adililhan
adililhan / ClosureTest.php
Created Jun 13, 2013
PHP'de sınıf içinde bulunan closure fonksiyondan üye metota erişmeyi sağlayan kod.
View ClosureTest.php
<?php
class ClosureTest {
public $getInfo;
public function __construct() {
$that = $this; // Yerel degisken olusturuldu (local variable)
$this->getInfo = function() use($that) {
@adililhan
adililhan / Late_Static_Binding.php
Created Nov 22, 2012
Late Static Binding Örneği
View Late_Static_Binding.php
<?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 / named_capturing.php
Created Nov 17, 2012
RegEx'de Named Capturing Groups Örneği
View named_capturing.php
<?php
$str = "ayva araba masa kitap defter 12 4378564 aslan";
preg_match_all('/(?P<rakamlar>[0-9]+)/', $str, $matches);
print_r ($matches);
@adililhan
adililhan / compressor.sh
Created Oct 12, 2012
Simple CSS Compressor
View compressor.sh
#!/bin/bash
# Author: Adil İlhan
files=`find . -name "*.css"`;
for i in $files
do
rmcss=`ls -d $i | sed s/\.css//g`
`cp $i $rmcss".uncompressed.css"`
`sed 's/^\/.*//g;s/^\*.*//g;/ \*/d;s/^[A-Z].*//g' $i > tmp && mv tmp $i`
@adililhan
adililhan / Polimorfizm.php
Created Oct 9, 2012
PHP'de polimorfizm örneği
View Polimorfizm.php
<?php
interface Telefon{
function TelefonEt($TelNo);
}
class CepTelefonu implements Telefon{
private $kontorVarMi = true;
private $operatorUygunMu = false;
You can’t perform that action at this time.