Jak sprawdzić które pliki się zmieniły względem innego branch?

Szybki post!

Jeśli chcesz sprawdzić które pliki zostały zmienione w branchu względem innego to wystarczy na danym branch wywołać komendę:

git diff --cached --name-only --diff-filter=ACM master

Wyświetli nam listę zmienionych plików względem master 🙂

Przydatne gdy chcemy np. zmienione pliki odpalić w ESLint czy innym narzędziu.

DevDocs – because your current docs sucks

I’m pretty sure that you use many documentations, for frameworks, languages and libraries. You have to add many pages to favourites or google for them. But there is a solution for this. And it’s ultra practical.

Just go to http://devdocs.io.

Quick info:

  • multiple docs,
  • stores all data in the browser storage,
  • support fuzzy search, yaay!
  • dark / light theme,
  • ultra quick.

How to use it? Simply choose docs which you want to have in the left sidebar. Then type something in search bar and instantly you will have the results 🙂 How cool is that?

So scrap all your favourites and start using DevDocs!

Everyday practise

Hi.

As you may know, all programers who want to more effective and productive should train. There are small tests that are called Kata. You should do them every single day.

Here’s my latest discover, excellent site with many Katas.

www.codewars.com

Enjoy! 🙂

PHP built in server and sessions

Hi!

Today I was struggling with Codeception tests. I’m working on Vagrant machine which has Apache2 installed.

Thing is that to view the page on my host machine I’m utilising Apache. But in the acceptance tests I’m using PHP built in server. To be specific https://github.com/tiger-seo/PhpBuiltinServer is used. It allows to run server as tests are running and destroy it at the end. It also supports many options.

Acceptance tests were broken. The Tester could not login. After some investigation I found that the issue was caused by read/write permissions for session. By default my Vagrant tries to store the session files in the /var/lib/php/session. As I opened my project in Apache earlier the permissions were given for it. There are two options to solve this:

  • change the path for session files,
  • change the permissions for the current path.

I choose first option. To be specific I changed it only for server used by tests. The extension allows to specify custom .ini file. So my file tests/php.ini look like this:

date.timezone="Europe/London"
session.save_path="/tmp"

Also here’s part of my codeception.yml file:

extensions:
    enabled:
        - Codeception\Extension\PhpBuiltinServer
    config:
        Codeception\Extension\PhpBuiltinServer:
            hostname: localhost
            port: 8000
            documentRoot: .
            phpIni: tests/php.ini
            startDelay: 0

Now session are working in tests 🙂

 

Cheers!

Bumping Postgres version on Vagrant + CentOS + Chef + postgresql cookbook

Today I was trying to bump the Postgres on my Vagrant to 9.4. The cookbook I’m using: https://supermarket.chef.io/cookbooks/postgresql.

Thing is that the cookbook defines a recipe yum_pgdg_postgresql. So to configure everything just add attributes, here’s example from my cookbook attributes default.rb file:

override['postgresql']['pgdg']['repo_rpm_url']['9.4']['centos']['6']['x86_64'] = 'http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm'
override['postgresql']['enable_pgdg_yum'] = true
override['postgresql']['version'] = "9.4"

First line is very important. Current version of cookbook postgresql provides up to 9.2 (source https://github.com/ngs/chef-postgresql/blob/master/attributes/default.rb#L200) version so we have to specify URL to fetch v9.4. As you can see it must specify all required data, postgresql version, os version and os technology used. All available versions for rpm are here http://yum.postgresql.org.

Second lines ensures that recipe yum_pgdg_postgresql will be included.

The last is obvious, version of postgresql to use.

Vagrant and NFS – problems?

Hi.

Recently I heard that using NFS is much faster than default shared folders in the Vagrant with VirtualBox. After some research I started to upgrade my Vagrantfile. Here is snippet how to make you shared partition NFS type:

config.vm.synced_folder ".", "/my-project", type: "nfs"

And that’s all!

But.

Yesterday I had a problem. When I tried to up the vagrant it failed. My recent changes (I changed the username on my OS X) broke something in the NFS configuration. Quick search and found the solution. Seems that I had wrong entries in the file /etc/exports. Here is bash fix:

sudo rm /etc/exports
sudo touch /etc/exports

After that all works like a charm 🙂

The machine started to work very fast. It should be set as a default sharing method…

 

PS. If you are working on the Windows, try a plugin https://github.com/winnfsd/vagrant-winnfsd

 

Cheers, Damian.