Posts

A Meteor way to structure AngularJS code wih Laravel 5.1

I have recently started working with  MeteorJS , which I find it an interesting tool for creating Web Apps. In two words about meteor — it has an installer, which includes MongoDB, a webserver and JS interpreter which is some kind of modified NodeJS (though I am not sure), and Meteor backend+frontend framework. All of that is inside a single installer and sets up with two clicks (and later it can be hosted on a subdomain with their origin like {yourappname}.meteor.com with a single comand — like “meteor publish {yourappname}), so I think it is definately worth trying, because it has such a big difference in approach compared to Laravel, ROR, Django and most frameworks, which mostly rely on HTTP requests (Meteor uses a protocol based on websockets which communicates with frontend framework to keep the code updated). On of the practices of structuring code with Meteor is setting them into folders “client”, “server”, and “common”. The client code is only interpreted by the cl...

Complete CircleCI setup for Laravel Dusk

Image
I have recently started working with Laravel 5.4 and totally love that it allows a ‘no pain’ solution for E2E(integration) tests which Laravel Dusk actually is. The problem is that it is easy to setup on local machine but the documentation on how to make all the tests to run correctly on CircleCI does lack a lot of info. Here are the settings that are mention in Laravel docs: test: pre: - "./vendor/laravel/dusk/bin/chromedriver-linux": background: true - cp .env.testing .env - "php artisan serve": background: true override: - php artisan dusk This does lack a lot of additional settings that are required. I am going to mention all of the and explain one by one, why they all are needed. Inside .env.testing we need  APP_URL  set to  http://127.0.0.1:8000  which is necessary, because we are working with E2E tests and browser can’t call the index.php file directly (like it could with PHPBrowse...

Easy way to embed diagrams in emails.

Image
All developers know, that you are very limited with data visualization when sending emails, because you can't use JS, to generate any charts/diagrams. But there is a really simple way to embed any data in your emails — you can just embed images that will be generated on your website on the fly based on the diagrams. The overall idea is the following — when sending an email — use links where images will be generated on the fly. The link will send the request to your app, which will use Phantomjs to ping your endpoint for diagram generation and make a screenshot of the page and return it as base64 imge which you will return as an image response. Lets see each one steb by step and see what happens: The link embeded in the email pings the webapp instead of fetching a resource right away (some parameters maybe sent as URL query parameters as well) The webapp runs your PhantomJS script passing it the parameters fetched from the link. PhantomJS pings your link with diag...