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 | |
| // BEFORE | |
| function signUp($subscription) { | |
| if ($subscription == 'monthly') { | |
| $this->createMonthlySubscription(); | |
| } elseif ($subscription == 'forever') { | |
| $this->createForeverSubscription(); | |
| } | |
| } |
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
| Hierarchical-recursive-query |
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
| COPIED FROM:- https://gist.githubusercontent.com/adamwathan/3584d1904e4f4c36096f/raw/66b5205fe189203b044eb0988b4fc0920bab897b/v-cloak.md | |
| ================================================================================= | |
| Handy helpers for controlling visibility of elements until Vue has compiled. | |
| Use like: | |
| ```html | |
| <div v-cloak> |
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
| //app/Http?Kernel.php | |
| 'web' => [ | |
| \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class, | |
| ] | |
| // resources/js/bootstrap.js | |
| window.axios.interceptors.response.use(undefined, function(error) { | |
| switch(error.response.status) { |
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
| Mozilla SSH | |
| Link: https://infosec.mozilla.org/guidelines/openssh |
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
| window.$ = document.querySelector.bind(document); | |
| window.$$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function(name, fn) { | |
| this.addEventListener(name, fn); | |
| } | |
| NodeList.prototype.__proto__ = Array.prototype; | |
| NodeList.prototype.on = function(name, fn) { |
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 | |
| /** | |
| * Refactor #1: | |
| */ | |
| // Before | |
| if ($user->type === 'admin' || $user->type === 'mod' || $user->type === 'author') { | |
| // Do something. | |
| } |
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
| # remove file form a commit | |
| $git reset HEAD^ path/to/file/to/revert | |
| $git commit --amend | |
| # add file to a commit | |
| $git add path/to/file/to/add | |
| $git commit --amend |
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
| File: AuthServiceProvider | |
| public function boot() | |
| { | |
| $this->registerPolicies(); | |
| Gate::define('update-product', function(User $user, Product $product) { | |
| return $product->user->is($user); | |
| }); | |
| } |