git config --global user.name "Your Name"
git config --global user.email "Your Email"
git config --global color.ui true
git config --global apply.whitespace nowarn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you want to remove all dashes but one from the string '-aaa----b-c-----d--e---f' resulting in '-aaa-b-c-d-e-f', you cannot use str_replace. Instead, use preg_replace: | |
<?php | |
$challenge = '-aaa----b-c-----d--e---f'; | |
echo str_replace('--', '-', $challenge).'<br>'; | |
echo preg_replace('/--+/', '-', $challenge).'<br>'; | |
?> | |
This outputs the following: | |
-aaa--b-c---d-e--f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
<?php | |
// comment out the following two lines when deployed to production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$prefix='lib/'; | |
require_once($prefix . 'Facebook/HttpClients/FacebookHttpable.php'); | |
require_once($prefix . 'Facebook/HttpClients/FacebookCurl.php'); | |
require_once($prefix . 'Facebook/HttpClients/FacebookCurlHttpClient.php'); | |
require_once($prefix . 'Facebook/Entities/AccessToken.php'); | |
require_once($prefix . 'Facebook/Entities/SignedRequest.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// include required files form Facebook SDK | |
require_once( 'Facebook/HttpClients/FacebookHttpable.php' ); | |
require_once( 'Facebook/HttpClients/FacebookCurl.php' ); | |
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' ); | |
require_once( 'Facebook/Entities/AccessToken.php' ); | |
require_once( 'Facebook/Entities/SignedRequest.php' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zip -r <oluşturulacak zip dosyası yolu> <sıkıştırılacak klasör yolu> | |
Ör: zip -r ./yedek/2015-02-17.zip ./production/site1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$c = new CDbCriteria(); | |
Hoge::model()->findAll($c); | |
// SELECT * FROM `hoge` `t` | |
$c = new CDbCriteria(); | |
$c->addSearchCondition('t.fuga', null); // null, false, ''などは無視されるようです | |
Hoge::model()->findAll($c); |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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, |