Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill | |
“In order to understand recursion, one must first understand recursion.” – Author Unknown | |
“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.” – Bjarne Stroustrup | |
“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila.” – Mitch Ratcliffe | |
“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -C.A.R. Hoare | |
“The gap between theory and practice is not as wide in theory as it is in practice.” – Author Unknown | |
“If builders built buildings the way progra |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
#!/bin/zsh | |
# | |
# Highlight a given file and copy it as RTF. | |
# | |
# Simon Olofsson <simon@olofsson.de> | |
# | |
set -o errexit | |
set -o nounset |
function scublish() { | |
sculpin generate --env=prod | |
cd output_prod | |
git add --all | |
git commit -am "$1" | |
git push origin master | |
cd .. | |
} |
# Tail Laravel and Webserver (NGINX & Apache 2) log files | |
# Compatible with Laravel 4 & 5 | |
# | |
alias tl="ls -d /var/log/nginx/* /var/log/apache2/* storage/logs/* app/storage/logs/* storage/laravel.log | grep -v 'gz$' | grep -v '1$' | xargs tail -f" |
Set-ExecutionPolicy RemoteSigned | |
# Edit HOSTS file Script | |
# Brian Gallagher (http://briangallagher.me) | |
# | |
# If you use Sublime text, and don't have an alias for it yet, uncomment the line below and change the path to ST | |
#Set-Alias st 'C:\Program Files\Sublime Text 3\sublime_text.exe' | |
$file = join-path -path $env:SystemRoot -childpath "System32\drivers\etc\hosts" |
99% of the time you're going to want to bail if you're expecting to find an entity by a specific key. Having code like the two private methods in the old code below in every single one of your handlers is crazy and not DRY.
I think the idea of "only throw exceptions when something exceptional happens" is too generic and doesn't take context into consideration.
A repository's only job is to find entities. If you give it a key and it can't find it, i think that's exceptional(in the context of the repository).
If it actually is expected in your client code it's not a big deal, catch the EntityNotFoundException
and carry on.
This is the workflow I really love with Less that's missing in Sass. Killer way to use a library like Bootstrap without coupling any of your markup to Bootstrap itself.
Import a bunch of vendor styles by reference only, mix in the classes you want to keep into your own aliases, no vendor class names end up in your compiled CSS.
Sass doesn't support reference import or the ability to mixin a class, only a mixin.
// Vendor less
.btn {
// a bunch
<?php | |
/** | |
* BITWISE FLAGS for Custom PHP Objects | |
* | |
* @link http://php.net/manual/en/language.operators.bitwise.php#108679 | |
* | |
* Sometimes I need a custom PHP Object that holds several boolean TRUE or FALSE values. | |
* I could easily include a variable for each of them, but as always, code has a way to | |
* get unweildy pretty fast. A more intelligent approach always seems to be the answer, |
<?php namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Request; | |
use View; | |
use App; | |
abstract class ApplicationsServiceProvider extends ServiceProvider | |
{ | |
public function register() |