Krzych Jończyk

Modern PHP, soft skills, productivity and time management.

Page 2 of 4

First attempt to Selenium and PHPUnit

This is a simple tutorial how to set up Selenium test with PHPUnit and phantomjs for easy and fast testing.

Today I wanted to learn something about Selenium. It’s very popular testing tool for any application that can be launched using a web browser, regardless of programming language or technology. I don’t know it very much, in fact, I know only how to set it up and write the simplest test 😉 But I want to share my today’s experiences because I cannot find any simple tutorial and had to glue together scripts, setting and libraries from all across the internet 😉

If you don’t like reading tutorials and want rather dig into example code I created the repository on GitHub where you can find everything I talk about here.
Continue reading

Squash – simple way to cleaner git repository

I use git for about 3 years. First I knew only how to use it with PhpStorm – cmd + t to update branch, cmd + k to commit and push changes. To make new branch I used menu and let the IDE do the work. It was fine until I heard about squash. I heard that it is often used when you contribute to someone’s repository. Maintainer of the repo often want clean history – if you want to contribute you must make pull requests with only one commit. And you may do it using squash.

It was a bit too much for me at that time: squash, rebase, push --force. No thanks 😉

Some time later a couple of people in my company started to use git more. They started to make squashes, rebases and so on. So if they wanted to use it I had to learn it too.
Continue reading

A few words about Git hooks

Lets talk about Git hooks. You’re using Git, right? No? But… you have to! Seriously, go to git-scm, GitHub or whatever and check it out.

In Git you have 3 types of files: tracked, ignored and untracked.
Tracked ones are simple – they’re just files you’ve added to the repository. This might be your application’s code. Ignored ones are also simple – if you don’t want to have any file you can add it to .gitignore file and you will have it locally but not in the repository. This might be any vendors you can easily install and don’t need to store them in your repository.

But untracked files are a little bit more complicated. These are files you’ve just created and didn’t specify what to do with them. Are those useful and should be added, or are they just temporary files or vendors? They might be also autogenerated files and this post is really about them.
Continue reading

Why I stop to code and want to come back?

It was a while since the last post. At first, I had no idea what to write about. My post about string performance comparison was quite a success, so everything seems to go pretty well.

But from about one and a half months I simply… don’t code at all! It’s because we have significant changes in our company. Teams started to be interdisciplinary, that means to developers joined marketing, analysis, communication guys. And I was responsible for helping people understand the change. In fact, I was true, full-time Scrum Master…
Continue reading

How to start developing in Symfony with only PHP installed?

This blog post will contain useful information for those, who want to start developing in Symfony without setting up a server (like apache or nginx) or installing docker.

PHP from version 5.4 has built in server. You can run it by executing in console php -S 127.0.0.1:8000 in your projects directory. When you go to this address (of course you can change the port and 127.0.0.1 to localhost) you’ll see the main page of your project.

Continue reading

PHPyths Buster: A great string performance test! (updated)

I was challenged in my last post to deeper check performance of strings. I think it will be quite interesting to test out some cases and say which way of using strings is the best.

In this post, I will check several string usages in PHP 5.6 and PHP 7.

To simplify testing I created a simple function which gets 2 arguments: an array of callable functions to compare (as many as you want) with names to display in summary, and a number of loops to test the function…
Continue reading

PHPyths Buster: Single quotes are faster than double quotes

As you may know, in PHP you can use single and double quotes for strings. These two lines are equal:

The only difference here is handling variables placed inside quotes. Let’s look at this simple example:

As you can see in double quotes variables are processed and in single quotes they aren’t.
But which one should I use?
Continue reading

PHPyths Buster: The power of simple CLI modes

If you know Python you know, that it has an interactive shell. The same as javascript, perhaps ruby and many many other languages. But did you know, that PHP has it also?

php -a

php -a command opens interactive shell in which you can write some simple samples of code and quickly validate some of your ideas. It works like Python shell and you can write in it simple statements, functions and so on.
Continue reading

PHPyths Buster: Annotations

I was working on a project in C# and ASP.NET MVC once. It was a long time ago. I can remember how happy I was. Earlier I was creating a project in PHP in the worst way: on an own framework. It was all old, shitty PHP. With big routing arrays, custom validation services, and ancient template engine, Smarty2.

When I started to create a project in ASP.NET I was astonished how many great features it has. One of them were annotations.
Continue reading

How to gain (at least!) one extra hour a day

Each day has 24 hours. Every one of us has 24 hours. There is nothing we can do about it.

Or is it? 🙂

I’m sure you have some “wasted” time every day. For me, that wasted time is going by bus to my work. It takes me about 45 to 50 minutes one way. Reading a book was not always possible, listening to music was not exactly developing.

For you, wasted time may mean cleaning up the apartment or working out. It’s any situation you do something automatically and your brain is bored 😉

What if you can use this time for something more, something developing? I do. I’m listening to podcasts.
Continue reading

« Older posts Newer posts »

© 2017 Krzych Jończyk

Theme by Anders NorenUp ↑