Showing 10 posts.

How to center fixed elements with JavaScript and jQuery

Posted on November 20th, 2018 in JavaScript by George

Sometime using top, right, bottom and left on a fixed element is not enough. 

I am sure you have been in the situation when you want to center a div container, image or other any html element which is position fixed.  In this article you will find out how to center any block element in the center of the screen using JavaScript and jQuery.

This is going to be achived using jQuery but can be done with plain JavaScript as well.

Follow the article to find out more.


Twig basic syntax, variables, filters and functions

Posted on October 26th, 2018 in Miscellaneous by George

Learn the basic syntax and how to declare variables, use filters and functions with twig. Twig has two delimiters :

If you want to try the code go to TWIG PLAYGROUND and for full reference on functions go to Twig Functions .

For full reference on twig go to Twig Documentation.

1. {%        %}  used to execute statements such as for-loops and filters;

2. {{         }} used to print the result of an expression to the templatep;


Reflection api example, inheritance and how to inspect private methods

Posted on October 21st, 2018 by George

Here is an example of PHP Reflection api and class inheritance. This example will cover a lot of things like getDocComment() method of reflection api and insanceof plus other things. In order to make sense of the code read the comments. Caveats: getDocComment will return only comments declared on the global scope of the namesapce/document in case. The comment must start in this form with double asterix /** and end */; 


Hash Table in Javascript

Posted on October 9th, 2018 in JavaScript

Dummy hash table for freeCodeCamp.


php Overloading example

Posted on October 3rd, 2018 in PhP by George

Example of Overloading in PHP.


Singleton class in PhP? The 'why' and 'how'.

Posted on October 2nd, 2018 in PhP by George


PHP Singleton example, the structure and practical example. Useful in order to restrict the number of instances. Estabilishing a connection with a database it is time consuming. Here Singleton can help by providing the same open connection when required instean of instantiating a new one.


React is easy. Why did I started with ReactJs?

Posted on September 30th, 2018 in JavaScript by George

 ReactJs it is a JavaScript library that is used to build User Interfaces and does it using JSX.  First time I have seen JSX I have been skeptical and my first reaction was: "what is going on here?". XML like syntax embedded in JavaScript, such an eloquent way of coding UI. The idea...



PHP casting and JavaScript coercion

Posted on September 28th, 2018 in PhP, JavaScript by George

PHP and JavaScript do not require explicit type definiton whenever you are creating a variable.The variable type is going to be defined by the context in wich the variable is assigned.Converting a data type using an explicit method it is called casting while converting a data type using an implicit (forced way) it called coercion. But what is PHP casting and what is JavaScript coercion? Are they alike? or are they different ? Read the article to find out what casting and coercion are and the syntax for each of the two languages.



How many data types has PHP? PhP vs Javascript primitive data types.

Posted on September 28th, 2018 in PhP by George

You can not be a programmer without properly understandig the data types of the program language you are using. Today we going to talk about data types in PhP and Javascript, enumerate all of them and add a short description/comment for each.


Effective JavaScript Merge sort algorithm

Posted on September 26th, 2018 in JavaScript by George

Merge sort it is very effective sorting algorithm with an Worst Time complexity of  O(n log(n)) being more effective in comparison with Quick sort   O(n^2) and insertion sort   O(n^2) for a hypothetical large data set.