Skip to content

Instantly share code, notes, and snippets.

View adililhan's full-sized avatar

adililhan

View GitHub Profile
@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.';
@adililhan
adililhan / DependencyInjectionTest.php
Created August 1, 2013 09:28
Symfony'nin dependency injection componentinin kullanımını göstermek amacıyla hazırlanmış örnek sınıfın, test sınıfı.
<?php
/**
* Tests of DependencyInjection.php
*/
class ControllerTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$this->obj = new Controller;
@adililhan
adililhan / DependencyInjection.php
Created August 1, 2013 09:30
Symfony'nin dependency injection componentinin kullanımını göstermek amacıyla hazırlanmış örnek sınıf.
<?php
/**
* Looking for tests DependencyInjectionTest.php
*/
require_once 'vendor/autoload.php';
interface iCurrency {
public function getExchangeRate();
<?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()
#include <stdio.h>
#include <stdlib.h>
#include <linux/seccomp.h>
#include <sys/prctl.h>
void main() {
FILE *filePoint;
filePoint = fopen("/tmp/test.txt", "a");
#include <stdio.h>
#include <stdlib.h>
#include <linux/seccomp.h>
#include <sys/prctl.h>
void main() {
FILE *filePoint;
filePoint = fopen("/tmp/test.txt", "a");
#include <stdio.h>
#include <stdlib.h>
#include <linux/seccomp.h>
#include <seccomp.h>
#include <sys/prctl.h>
void main() {
FILE *filePoint;
filePoint = fopen("/tmp/test.txt", "a");
#include <stdio.h>
#include <sys/utsname.h>
#include <seccomp.h>
void main() {
puts("What's up?");
scmp_filter_ctx ctx;
ctx = seccomp_init(SCMP_ACT_ALLOW);
seccomp_rule_add(ctx, SCMP_ACT_KILL, SCMP_SYS(uname), 0);
#include <stdio.h>
#include <sys/utsname.h>
void main() {
puts("What's up?");
struct utsname unameData;
uname(&unameData);
printf("%s \n", unameData.sysname);
}