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
| interface FieldInterface { | |
| name: string; | |
| rules: string[]; | |
| } | |
| interface ErrorFieldInterface { | |
| name: string; | |
| message?: string; | |
| } |
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
| /* | |
| 1. npm install babel-core babel-preset-env babelify browser-sync browserify gulp gulp-autoprefixer gulp-babel gulp-cssnano gulp-rename gulp-sass gulp-uglify gulp-watch vinyl-source-stream --save-dev | |
| 2. create file `.babelrc` and insert | |
| { | |
| "presets": ["env"] | |
| } | |
| 3. create `src` folder and create `sass` and `js` folder inside. Start file name `style.scss` and `app.js` (if you wish to change then do it in gulpfile) | |
| */ | |
| // tested with gulp 3.9.1 |
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
| // URL needs to be like this | |
| // https://script.google.com/a/example.com/macros/s/id/exec | |
| // https://script.google.com/macros/s/id/exec | |
| // If script isn't loaded - manage version and create new and then again deploy | |
| // ============================================================ | |
| // Your clientside script should actually look like this (jquery example): | |
| // ============================================================ |
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 | |
| abstract class Transformer { | |
| protected function responseJson($array) | |
| { | |
| return json_encode($array); | |
| } | |
| abstract public function transform($item); |
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 | |
| interface MailServiceInterface { | |
| public function sendEmail(); | |
| } | |
| class SMTPService implements MailServiceInterface { | |
| public function sendEmail() | |
| { |
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 | |
| /** | |
| * PHP decorator pattern example | |
| */ | |
| interface TransactionInterface { | |
| public function getCost(); | |
| } |
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 | |
| abstract class Status { | |
| protected $successor; | |
| abstract public function check(ServerStatus $serverStatus); | |
| public function succeedWith(Status $status) | |
| { | |
| $this->successor = $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
| <?php | |
| interface NotificationInterface { | |
| public function send(); | |
| } | |
| class Notification implements NotificationInterface { | |
| public function send() | |
| { | |
| return 'Default notification service!'; |
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
| :) |
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
| function LinkedList() { | |
| this.list = null; | |
| this.length = 0; | |
| } | |
| LinkedList.prototype.add = function(value) { | |
| if( this.list === null ) { | |
| this.list = this._node(value); | |
| } | |
| else { |