Remove unstaged changes in all tracked files.
git checkout -- .
Remove unstaged changes in one file.
` git checkout -- [filepath]
| <?php | |
| ini_set('xdebug.var_display_max_depth', 10); | |
| ini_set('xdebug.var_display_max_children', 500); | |
| ini_set('xdebug.var_display_max_data', 2000); |
Remove unstaged changes in all tracked files.
git checkout -- .
Remove unstaged changes in one file.
` git checkout -- [filepath]
Translations: Korean (by Yongwoo Lee)
Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.
I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).
| <?php | |
| namespace Tests; | |
| use PHPUnit\Framework\TestCase; | |
| class UserRegistrationTest extends TestCase | |
| { | |
| public function tearDown() |
| <?php | |
| /** | |
| * Translates a camel case string into a string with | |
| * underscores (e.g. firstName -> first_name) | |
| * | |
| * @param string $str String in camel case format | |
| * @return string $str Translated into underscore format | |
| */ | |
| function fromCamelCase($str) { | |
| $str[0] = strtolower($str[0]); |
| <?php | |
| /** | |
| * Класс работы с сессиями | |
| * | |
| * Использование | |
| * session::getInstance()->start(); | |
| * dump(session::getInstance()->get('qwer')); | |
| * session::getInstance()->set('qwer', 'qwer'); | |
| * 1 параметр $key - наименование сессии | |
| * 2 параметр $value - значени сессии |
A collection of resources to learn object-oriented programming and related concepts for PHP developers. Original Please see CONTRIBUTING for details and contribute. ;)
| <?php | |
| function file_get_mime($filename) { | |
| $extension = pathinfo($filename, PATHINFO_EXTENSION); | |
| $mimes = array( | |
| 'audio/mp4' => 'm4a|f4a|f4b', | |
| 'audio/ogg' => 'oga|ogg', | |
| 'audio/&' => 'mid|midi|mp3|wav', | |
| 'application/javascript' => 'js|jsonp', |
| /* | |
| Indexes are best used on columns that are frequently used in where clauses, and in any kind of sorting, such as "order by". | |
| If we assign ID as a primary key, we don't need one there. | |
| */ | |
| CREATE INDEX tablename_columnname_idx | |
| ON tablename (columnname) |
| i=0; | |
| for f in *; | |
| do | |
| d=dir_$(printf %03d $((i/100+1))); | |
| mkdir -p $d; | |
| mv "$f" $d; | |
| let i++; | |
| done |