PhpStorm Tips, ticks and standard setup
- Tips and Tracks for PHPStorm (PHPStorm Tips and Tricks.md)
- Standard setup for PHP projects (Standard.md)
#!/bin/bash | |
# This is a very naive script, it doesn't do grouping and returns all branches | |
# I only really care about branches that have not seen commits in two months | |
# | |
# I am hoping to find some time to write a tool that can output these reports for me | |
# In the meantime, I am using this | |
echo "Merged branches" | |
for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r |
# git psh(hh) | |
git config --global alias.psh '!git pull --rebase=merges; git push'; | |
git config --global alias.pshhh '!git stash; git pull --rebase=merges; git push; git stash pop'; |
# The command finds the most recent tag that is reachable from a commit. | |
# If the tag points to the commit, then only the tag is shown. | |
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object | |
# and the abbreviated object name of the most recent commit. | |
git describe | |
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix: | |
git describe --abbrev=0 | |
# other examples |
<div class="row" id="box-search"> | |
<div class="thumbnail text-center"> | |
<img src="img/cafe.jpg" alt="" class="img-responsive"> | |
<div class="caption"> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, quisquam?</p> | |
</div> | |
</div> | |
</div> |
<?php namespace Vendor\Library; | |
use Another\Vendor\Library\ClassName; | |
abstract class ClassName extends AnotherClass implements Countable, Serializable | |
{ | |
const CONSTANTS = 'top'; | |
use someTrait, anotherTrait { | |
anotherTrait::traitMethod insteadof someTrait; |
{% if app.session.flashbag.peekAll|length > 0 %} | |
{% for type, messages in app.session.flashbag.all %} | |
{% for message in messages %} | |
<div class="{{ type ? type : '' }}"> | |
{{ message|trans({}, domain|default('messages')) }} | |
</div> | |
{% endfor %} | |
{% endfor %} | |
{% endif %} |
<?php // ~/.config/psysh/config.php | |
// Anything not Laravel - let's try to autoload something likely to exist | |
if (!defined('LARAVEL_START')) { | |
return [ | |
'defaultIncludes' => [ | |
getcwd().'/vendor/autoload.php', | |
getcwd().'/bootstrap/autoload.php', | |
], | |
]; |
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).