Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| new Vue({ | |
| el: "#app", | |
| mounted() { | |
| this.enableInterceptor() | |
| }, | |
| data: { | |
| isLoading: false, | |
| axiosInterceptor: null, | |
| }, | |
| methods: { |
| <?php | |
| /** | |
| * Example of useless Repository abstraction for Eloquent. | |
| * From "Architecture of complex web applications" book. | |
| * https://adelf.tech/2019/architecture-of-complex-web-applications | |
| */ | |
| interface PollRepository | |
| { | |
| //... some other actions |
| <?php | |
| require __DIR__ . '/vendor/autoload.php'; | |
| $dsn = 'mysql:dbname=db1;host=127.0.0.1'; | |
| $user = 'root'; | |
| $password = '(disensor)'; | |
| try { | |
| $dbh = new PDO($dsn, $user, $password); |
| /** | |
| * You have this: | |
| * <a href="http://localhost/data/delete/1" data-method="delete" data-confirm="Are you sure?">Delete</a> | |
| * | |
| * When above link clicked, below will rendered & triggered: | |
| * <form method="POST" action="http://localhost/data/delete/1"> | |
| * <input type="text" name="_token" value="{the-laravel-token}"> | |
| * <input type="text" name="_method" value="delete"> | |
| * </form> | |
| * |
| ## http://domain.com and http://www.domain.com redirect to https://www.domain.com | |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server ipv6only=on; | |
| server_name domain.com www.domain.com; | |
| include /etc/nginx/snippets/letsencrypt.conf; | |
| location / { | |
| return 301 https://www.domain.com$request_uri; |
| #Steps to install latest Laravel, LEMP on AWS Ubuntu 14.4 version. | |
| This tutorial is the improvised verision of this [tutorial on Digitalocean](https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04) based on my experience. | |
| ## Install PHP 7 on Ubuntu | |
| Run the following commands in sequence. | |
| ``` | |
| sudo apt-get install -y language-pack-en-base | |
| sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php | |
| sudo apt-get update | |
| sudo apt-get install zip unzip |
| <?php | |
| /** | |
| * Gera a paginação dos itens de um array ou collection. | |
| * | |
| * @param array|Collection $items | |
| * @param int $perPage | |
| * @param int $page | |
| * @param array $options | |
| * | |
| * @return LengthAwarePaginator |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| var debug = process.env.NODE_ENV !== "production"; | |
| var webpack = require('webpack'); | |
| module.exports = { | |
| context: __dirname, | |
| devtool: debug ? "inline-sourcemap" : null, | |
| entry: "./js/scripts.js", | |
| output: { | |
| path: __dirname + "/js", | |
| filename: "scripts.min.js" |
| <?php | |
| preg_match_all('~<img ([^>]+)>~i', $yourLongArticle, $matches); | |
| $images = []; | |
| foreach ($matches[1] as $str) { | |
| preg_match_all('~([a-z]([a-z0-9]*)?)=("|\')(.*?)("|\')~is', $str, $pairs); | |
| $images[] = array_combine($pairs[1], $pairs[4]); | |
| } | |
| if (!empty($images[0])) { | |
| return $images[0]['src']; | |
| } |