Skip to content

Instantly share code, notes, and snippets.

View tayfunerbilen's full-sized avatar
🙉
busy for earthly things

Tayfun Erbilen tayfunerbilen

🙉
busy for earthly things
View GitHub Profile
<?php
function topla($sayi1, $sayi2){
return $sayi1 + $sayi2;
}
$topla = function($sayi1, $sayi2){
return $sayi1 + $sayi2;
};
<?php
function dizi_filtrele($callback, $arr)
{
$result = [];
if (is_callable($callback) && is_array($arr)){
foreach($arr as $key => $val){
$result[] = call_user_func($callback, $val);
}
}
<?php
class Hata extends Exception {
public function printJSON()
{
$arr = [
'mesaj' => $this->message,
'kod' => $this->code,
'satir' => $this->line,
@tayfunerbilen
tayfunerbilen / custom-registration.php
Created August 27, 2017 13:05 — forked from trslater/custom-registration.php
Custom Registration Plugin
<?php
/*
Plugin Name: Custom Registration
Description: Updates user rating based on number of posts.
Version: 1.1
Author: Tristan Slater w/ Agbonghama Collins
Author URI: http://kanso.ca
*/
@tayfunerbilen
tayfunerbilen / Combinations_Calculator.js
Last active July 22, 2016 15:24
Combinations_Calculator.js
function factorial(number){
var value = number;
for ( var i = number; i > 1; i-- ){
value *= i - 1;
}
return value;
};
function combination(n, r){
if ( n == r ) return 1;
@tayfunerbilen
tayfunerbilen / imdb.episode.php
Created April 14, 2016 13:30
IMDB için ilgili diziye ait bölümlerin listesini array olarak geriye döndürür
<?php
/**
* @param $imdbID
* @param $season
* @return array
*/
function imdbEpisode($imdbID, $season)
{
@tayfunerbilen
tayfunerbilen / ckeditor_example.js
Created April 7, 2016 14:45
ckeditor'da içeriklerin olduğu gibi kalması için ilgili kod parçacığı
CKEDITOR.replace('editor', {
enterMode: CKEDITOR.ENTER_DIV,
allowedContent: true
});
@tayfunerbilen
tayfunerbilen / file_size.php
Created April 7, 2016 14:44
dosya boyutunu hesaplayan fonksiyon
<?php
/**
* @param $bytes
* @return string
*/
function formatSizeUnits($bytes)
{
if ($bytes >= 1073741824) {
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
@tayfunerbilen
tayfunerbilen / all_countries.php
Created April 4, 2016 10:37
Tüm ülkeleri iso kodlarıyla birlikte barındıran array
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
@tayfunerbilen
tayfunerbilen / ip_country.php
Created April 4, 2016 10:36
IP adresinden ülke bulmak için gerekli kodlar
<?php
/**
* @param null $ip
* @param string $purpose
* @param bool|TRUE $deep_detect
* @return array|null|string
*/
function ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE)
{