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 | |
#modifed version of https://gist.github.com/pitch-gist/2999707 | |
//by twitter/abdu1m | |
#htaccess: | |
// RewriteCond %{REQUEST_URI} !/maintenance.php$ | |
// RewriteCond %{HTTP:X-FORWARDED-FOR} !=151.254.68.111 #this is your ip | |
// RewriteRule $ /maintenance.php [R=302,L] | |
?> | |
<!doctype html> |
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 | |
/* | |
* Get the diff between two collections | |
* | |
* @param Illuminate\Support\Collection|array $items | |
* | |
* @return static | |
*/ | |
Collection::macro('mdiff', function($items){ |
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
@import url(//fonts.googleapis.com/earlyaccess/notokufiarabic.css); | |
body{ | |
direction: rtl; | |
font-family: 'Noto Kufi Arabic', sans-serif; | |
text-align:right; | |
} | |
h1, h2, h3, h4, h5, h6{ | |
font-family: 'Noto Kufi Arabic', sans-serif; |
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 | |
//the middleware | |
$middleware1 = function ($request, $carry) { | |
echo "first middleware \n"; | |
return $carry($request); | |
}; |
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 | |
/* | |
* Improved version of Collection->map method | |
* | |
* @param callable $callback | |
* | |
* @return Illuminate\Support\Collection | |
*/ | |
Illuminate\Support\Collection::macro('loop', function(callable $callback){ |
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 | |
/** | |
* drop the first or last {$limit} items. | |
* | |
* @param int $limit | |
* @return Illuminate\Support\Collection | |
*/ | |
Illuminate\Support\Collection::macro('drop', function(int $limit){ | |
if ($limit < 0) { | |
return $this->slice(0, $limit); |
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
## | |
# git hook to run a command after `git pull` for laravel by @abdu1m | |
## | |
# source: https://gist.github.com/sindresorhus/7996717 | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} |
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 | |
namespace App; | |
use Illuminate\Support\Facades\Cache; | |
trait Cacheable | |
{ | |
public function __call($methodName, $arguments) |
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
-1- edit ~/.composer/vendor/laravel/valet/cli/stubs/openssl.conf | |
Change: | |
basicConstraints = CA:FALSE | |
To: | |
basicConstraints = CA:TRUE,pathlen:0 | |
save 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
function slugify(text) { | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') | |
.replace(/[^\w\u0621-\u064A0-9-]+/g, '') | |
.replace(/\-\-+/g, '-') | |
.replace(/^-+/, '').replace(/-+$/, ''); | |
} |
OlderNewer