How to install the latest Node.js on Ubuntu

Ubuntu repositories let you install old 0.x.x version of Node.js.
But you definitely┬áneed the latest version. Here you’ll find few fast steps to get it:

    • Download the latest LTS or current stable version from https://nodejs.org/en/download/
    • You will download a tar.xz archive
    • The rigth way how to install NodeJS tar.xz archive
      (Don’t forget to write your version in package name)

That`s all. Now you have latest Node.js and npm installed on you Ubuntu system.

All methods to install Node.js using standard repositories or PPA will give old version.

Quote

Text submit link with confirmation on JavaScript

You can see a simple JS construction in onclick attribute.
We can place our submit link in <form></form> tags or somewhere else.

Quote

Google Analytics: Custom URL tracking with _trackPageview

When you need to push custom URL to Google Analytics:

Standard tracking:

Custom URL:

or with parameter on PHP:

It helps to solve problems when you have two projects connected through Google Analytics with each other and one of them uses pageview statistics of another one (billing CRM, etc).

In my case, the structure of URLs of the first project was changed, but billing system is looking the statistics for old URL structure.

thumb2134

Sitemap or other XML generator on Phalcon Framework

Sometimes we need not only to create an xml-file and put it into directory in project’s root but also to generate it on the fly.

Routing settings for Phalcon:

Sitemap Controller:

!!! You don’t need any views for this.
!!! Don’t forget about PHP Documentation (Class DOMDocument, for example)
!!! Also we need to cache generated files on server to enhance security against DDoS attacks! Configure your nginx or other web-server for this case.

Small result of this:

 

paginator_thumbnail
Image

Phalcon Built-in Pagination

If you don’t want to reinvent a bicycle, you can use Phalcon\Paginator\Adapter\Model.

My solution has a little differences.

First of all I don’t use GET or POST methods to get the page parameter. I include it into route:

Then I can get “page” variable in my controller’s initialize and use Paginator Model in indexAction.

Continue reading

Aside

How to sort an array of objects by object’s field

There are usort and uasort functions that use a user-defined comparison function.

 

Link

coduo/php-humanizer – when you need readable view of values

This component can make a lot of cool things. It can transform variable names, ordinalize numbers, make suffixes for quantities, transform dates and time, show differences between them etc.

My favourite features:

Composer:

coduo/php-humanizer Must use!

CXO-Items-Trello
Image

Trello – task manager with great usability

I’ve been using Trello for six month and it helps me to keep my task-list in order.

There we can create a separate board for project, on the board – lists with tasks. I usually have several standard lists – “backlog”, “to do”, “doing”, “done”, “archive”. It helps me to organize my workflow and to save my time. Also it’s easy to report about work for my PM or team.

It`s a great thing for a small dev team. There we can appoint a responsible person for a task, mark them with different labels, leave comments for tasks, make attachments, etc.

And most importantly – it’s FREE. Must use! Trello.com

daterange
Link

Date Range Picker for Bootstrap – cool thing, 5 min install

Date Range Picker by dangrossman – JavaScript component for Twitter Bootstrap Framework provides lightweigth, usefull and nice instruments for choosing date ranges for input forms, filters etc. Easy to install, easy to use.

As for me, it took 5 minutes to apply it for filtering entries by date in administrator panel in one of my projects.

Date Range Picker Webpage
Date Range Picker on GitHub