Posted by & filed under Webdev.

Learn

Python

Posted by & filed under Webdev.

Laradock is a Docker PHP development environment. It facilitate running PHP Apps on Docker.

Laradock is configured to run Laravel Apps by default, and it can be modifyed to run all kinds of PHP Apps (Symfony, Codeigniter, WordPress, Drupal…).

Use Docker first and learn about it later.

Github

Posted by & filed under Study.

This is my multi-month study plan for going from web developer (self-taught, no CS degree) to Google software engineer.

This long list has been extracted and expanded from Google’s coaching notes, so these are the things you need to know. There are extra items I added at the bottom that may come up in the interview or be helpful in solving a problem. Many items are from Steve Yegge’s “Get that job at Google” and are reflected sometimes word-for-word in Google’s coaching notes.

Full article on Github

Posted by & filed under Webdev.

A search for “dependency injection container” on packagist currently provides over 95 pages of results. It is safe to say that this particular “wheel” has been invented.

However, no chef ever learned to cook using only ready meals. Likewise, no developer ever learned programming using only “ready code”.

In this article, we are going to learn how to make a simple dependency injection container package. All of the code written in this article, plus PHPDoc annotations and unit tests with 100% coverage is available at this GitHub repository. It is also listed on Packagist.
Read more »

Posted by & filed under Webdev.

Modern PHP testing for everyone.

codeception

Codeception PHP Testing Framework is designed to work just out of the box. This means its installation requires minimal steps and no external dependencies preinstalled (except PHP, of course). Only one configuration step should be taken and you are ready to test your web application from an eye of actual user.

Project Home Yii2 extension
Acceptance Test

<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('create wiki page');
$I->amOnPage('/');
$I->click('Pages');
$I->click('New');
$I->see('New Page');
$I->fillField('title', 'Hobbit');
$I->fillField('body', 'By Peter Jackson');
$I->click('Save');
$I->see('page created'); // notice generated
$I->see('Hobbit','h1'); // head of page of is our title
$I->seeInCurrentUrl('pages/hobbit'); 
$I->seeInDatabase('pages', array('title' => 'Hobbit'));
?>

API Test

<?php
$I = new ApiTester($scenario);
$I->wantTo('create a new user by API');
$I->amHttpAuthenticated('davert','123456');
$I->haveHttpHeader('Content-Type','application/x-www-form-urlencoded');
$I->sendPOST('/users', array('name' => 'davert' ));
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(array('result' => 'ok'));
?>

Unit Test

<?php
use \Codeception\Util\Stub;
class UserTest extends \Codeception\TestCase\Test
{
    public function testUserSave() {
        $user = Stub::make('User');
        $user->setName('davert');
        $this->assertEquals('davert', $user->getName());
        $user->save();
        $this->tester->seeInDatabase('users', array('name' => 'davert'));
    }
}
?>

Posted by & filed under Webdev.

Really fast deployer and server automation tool

mina_logo

Mina lets you build and run scripts to manage your app deployments on servers via SSH.

Mina works really fast because it’s a deploy Bash script generator. It generates an entire procedure as a Bash script and runs it remotely in the server.

Compare this to the likes of Vlad or Capistrano, where each command is ran separately on their own SSH sessions. Mina only creates one SSH session per deploy, minimizing the SSH connection overhead.

$ mina deploy --verbose

-----> Creating the build path
       $ mkdir tmp/build-128293482394
-----> Cloning the Git repository
       $ git clone https://github.com/nadarei/flipstack.git . -n --recursive
       Cloning... done.
-----> Installing gem dependencies using Bundler
       $ bundle install --without development:test
       Using i18n (0.6.0)
       Using multi_json (1.0.4)
       ...
       Your bundle is complete! It was installed to ./vendor/bundle
-----> Moving to releases/4
       $ mv "./tmp/build-128293482394" "releases/4"
-----> Symlinking to current
       $ ln -nfs releases/4 current
-----> Launching
       $ cd releases/4
       $ sudo service nginx restart
-----> Done. Deployed v4

Github Project Home

Posted by & filed under Webdev.

Here is my list of developer goals for 2015:

  • Start new project
  • Raise my Python skills
  • Read at least 10 books about development
  • Learn at least 2 new technology/framework