- Because you can
- Because you have time to spare
- Maybe you think they look cool or want to save them for wallpapers or something
- Maybe it reminds you of that one time... You know which time I'm talking about
This file contains hidden or 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 | |
use Illuminate\Database\Query\Builder; | |
Builder::macro('orderByNulls', function ($column, $direction = 'asc', $nulls = 'last', $bindings = []) { | |
$column = $this->getGrammar()->wrap($column); | |
$direction = strtolower($direction) === 'asc' ? 'asc' : 'desc'; | |
$nulls = strtolower($nulls) === 'first' ? 'NULLS FIRST' : 'NULLS LAST'; | |
return $this->orderByRaw("$column $direction $nulls", $bindings); | |
}); |
This file contains hidden or 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 | |
/* | |
Class for reading and writing array data in json format | |
Author: Sarfraz Ahmed ([email protected]) | |
*/ | |
class JsonTexter | |
{ | |
protected $file = null; | |
public function __construct($file) |
This file contains hidden or 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
desc: | |
In addition, if the current time is less than 30 minutes from endhour, expired is also counted as expired. | |
Array | |
( | |
[0] => Array | |
( | |
[date] => 2019-06-01 | |
[week] => Saturday | |
[subdate] => 06-01 |
This file contains hidden or 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 | |
// Usage: | |
// Before | |
@if ($errors->has('email')) | |
<span>{{ $errors->first('email') }}</span> | |
@endif | |
// After: |
This file contains hidden or 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
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |
This file contains hidden or 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 | |
// Examples for URL: https://example.com/subFolder/yourfile.php?var=blabla#12345 | |
//built-in function | |
$x = parse_url($url); | |
$x['scheme'] 🡺 https | |
$x['host'] 🡺 example.com (or with WWW) | |
$x['path'] 🡺 /subFolder/yourfile.php | |
$x['query'] 🡺 var=blabla | |
$x['fragment'] 🡺 12345 // hashtag outputed only in case, when hashtag-containing string was manually passed to function, otherwise PHP is unable to recognise hashtags in $_SERVER |
This file contains hidden or 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 | |
/** | |
* Dumps a given variable along with some additional data. | |
* | |
* @param mixed $var | |
* @param bool $pretty | |
*/ | |
function dd($var, $pretty = false) | |
{ |
NewerOlder