Skip to content

Instantly share code, notes, and snippets.

<?php
/* @var $slides app\models\SliderIcerik[] */
//use app\models\SliderIcerik;
?>
<div class="fullwidthbanner">
<div class="tp-banner">

IDE autocompletion for custom components

Using IDE for development is quite typical nowadays because of the comfort it provides. It detects typos and errors, suggests code improvements and, of course, provides code autocomplete. For Yii 2.0 it works quite good out of the box but not in case of custom application components i.e. Yii::$app->mycomponent->something.

Using custom Yii class

The best way to give IDE some hints is to use your own Yii file. Let's check application's index.php:

@sercey
sercey / gist:db54066db2515f8bcc7f
Last active November 18, 2015 00:02
Yii 2 Basic Force SSL htaccess
# Mod_Autoindex
<IfModule mod_autoindex.c>
# Disable Indexes
Options -Indexes
</IfModule>
# Mod_Rewrite
<IfModule mod_rewrite.c>
# Enable symlinks
Options +FollowSymlinks
@sercey
sercey / parse-twitter-date-tr
Last active August 29, 2015 14:16
Twitter Türkçe Zaman
function parseTwitterDate(tdate) {
var system_date = new Date(Date.parse(tdate));
var user_date = new Date();
var diff = Math.floor((user_date - system_date) / 1000);
if (diff <= 1) {return "şuan";}
if (diff < 20) {return diff + " saniye önce";}
if (diff <= 3540) {return Math.round(diff / 60) + " dakika önce";}
if (diff <= 5400) {return "1 saat önce";}
if (diff <= 86400) {return Math.round(diff / 3600) + " saat önce";}
if (diff <= 129600) {return "1 gün önce";}
@sercey
sercey / php-recursive-delete.php
Created March 10, 2015 22:26
Belirtilen dizindeki tüm dosya ve klasorleri siler
public function recurse_remove($dir, $remove_parent = false){
$it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
$files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
foreach($files as $file) {
if ($file->isDir()){
rmdir($file->getRealPath());
} else {
unlink($file->getRealPath());
}
}
CREATE TABLE `yok_bolumler` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`fakulteId` varchar(40) NOT NULL,
`universiteId` int(6) NOT NULL,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `fakulteHash` (`fakulteId`)
) ENGINE=MyISAM;
INSERT INTO `yok_bolumler` (`id`, `fakulteId`, `universiteId`, `name`) VALUES
@sercey
sercey / pk.sql
Created November 25, 2013 10:12
This file has been truncated, but you can view the full file.
/*
Türkiye'nin il, ilçe , semt, mahalle, posta kodu veritabanı
GÜNCEL : 19.04.2013
Kaynak : PTT
Oluşturan : http://www.twitter.com/tserpico
*/
DROP TABLE IF EXISTS `pk`;
CREATE TABLE `pk` (
`mahalle_id` bigint(10) NOT NULL AUTO_INCREMENT,
We can't make this file beautiful and searchable because it's too large.
"id","parentID","isim","haschild"
23365,0,"Acura",1
93026,23365,"CL",1
93027,93026,"2.2",0
93028,93026,"2.3",0
93029,93026,"3.0",0
23366,23365,"RL",1
93031,23366,"3.5",0
63999,23366,"3.7 VTEC",0
91976,23365,"RSX",1
This file has been truncated, but you can view the full file.
"id","parentID","isim","haschild"
3518,0,"Emlak",1
3613,3518,"Konut",1
16623,3613,"Satılık",1
16633,16623,"Daire",0
152512,16623,"Residence",0
16635,16623,"Müstakil Ev",0
16636,16623,"Villa",0
152456,16623,"Çiftlik Evi",0
152480,16623,"Köşk &amp; Konak",0