Adding an existing project to GitHub using the command line

Adding an existing project to GitHub repository using the command line

DOM HELPER CLASS

In this class, we will have a helper class that will allow us to do the following: clear event listener from an element. move an element to another location ..etc

Prototype Methods

If you need to use the prototype to add new general methods to any general protoype or construct functions such as Object, Array, String .. etc, here are few examples

Print a pdf file directly from Laravel

In case you want to directly print a pdf file from the browser in Laravel, here is a snippet of code that might help you do it.

Convert an object into an array or a string

In order to convert an object into an array, this is easy using the Object.values() method. On the other hand if you want to convert an object into a string, any Object can be converted to a string using the JSON.stringify() method.

bind(), call() and apply()

In alot of cases in javascript, you will find it very difficult to pass certain parameter values or context to the function call. For example, the keyword 'this' which will mean very different things each time it is used depending on the context in which it was used and how it was used, inside a function or outside it, inside a function defined with the function keyword or an arrow function. Also when triggering an event that call a function and you need to pass/bind some parameters to this function. So here is a good explanation for the bind(), call() and apply() functions.

Looping through an object to get its properties and values

In case you have an object and need to loop through all its keys or properties and its related values you can use the following syntax

Array unique values

In order to get the unique values from an array , there are many ways, through using Set , or filter() method on array values or other methods.

Elasticsearch different url examples

Here are a sample list for different operations you might need to do with elatsicsearch indices.

Deleting and re-index an elasticsearch index in Laravel

If you need to change the mapping of an elasticsearch index, then you have to remove it first and then re-create and re-index it again. Here is how you can do this in a Laravel application.