/app
├── /Application
| ├── /Exceptions
| ├── /Middlewares
| ├── /Providers
| ├── /Requests
├── /Domain
| ├── /MyDomainA
| | ├── /Contracts
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\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
class ValidationResponseWithRuleName | |
{ | |
/** |
Keep in mind that this implementation requires an api for fetching data, and assumes the following response schema:
{
"perPageOptions": [
15, 50, 100
],
"actions": [
"Delete all", "Publish All", "Unpublish All"
],
The new postman native app for linux is great! On Ubuntu though, it doesn't create any symbolic links to your app — I link to launch all my apps via Synapse, the simple but powerful application launcher. Follow these short steps to launch your Postman instance via Synapse/any other application launcher:
- Copy the app directory to a folder of your choice
- Download the image from here and place it in the same folder.
- Create a *.desktop file in /home/username/.local/share/applications/postman.desktop
- Copy paste the contents:
[Desktop Entry]
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
DROP TABLE IF EXISTS `things`; | |
CREATE TABLE `things` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`nbr` int(11) NOT NULL, | |
`thing` varchar(255) NOT NULL, | |
`createdAt` datetime NOT NULL DEFAULT NOW(), | |
`updatedAt` datetime NOT NULL DEFAULT NOW() ON UPDATE NOW(), | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `nbr_unique` (`nbr`) |
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
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |
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 File Information | |
*/ | |
// Assuming these come from some data source in your app | |
$s3FileKey = 's3/key/path/to/file.ext'; | |
$fileName = 'file.ext'; |
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\Rules; | |
use Illuminate\Contracts\Validation\Rule; | |
class ValidGmailAddress implements Rule | |
{ | |
/** | |
* Determine if the validation rule passes. |
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
// Original source: https://gistpages.com/posts/go-lang-get-current-date | |
// Go playground: https://play.golang.org/p/gBO8rdKI6UF | |
// time.Format should use the layout, Mon Jan 2 15:04:05 MST 2006 to show the pattern | |
package main | |
import ( | |
"fmt" | |
"time" | |
) |
NewerOlder