Disable Animation (animate.css) on Mobile Device

If you using any css animation library and which creates some problem (appearing scroll bar, bouncing element, etc) on the mobile display. Here I have shared a code snippet to disable animation on a mobile device. Add this codes in your stylesheet to overcome this issue.

https://gist.github.com/sohelrana820/d8e6de0317b9e005df40bbc10da7543b

Source Tree pull You have not concluded your merge (MERGE_HEAD exists)?

Sometimes we got this error message (Source Tree pull You have not concluded your merge (MERGE_HEAD exists)?) while we are working through GIT. It’s a wired issue and sometimes very dangerous. Here I have shared very short tips to overcome this scenario

Af first tries git commit. If it doesn’t work, you run this command

git merge --abort
git reset --merge

Hope this will help you to solve your problem.

How to Vertically Center Alignment With CSS

Looking for a solution for the vertically center alignment of elements? Sometimes we need to vertically center align an element within its parent element. This post with help you a lot to do this. Follow this snippet and make your element vertically center.

The example of Vertically Center Alignment:
body {
 background: yellowgreen;
 font-size: 80%;
 padding: 20px;
}

.parent_div {
 position: relative;
 background: #FFF;
 height: 200px;
 width: 600px;
 margin: 0 auto;
 padding: 20px;
 resize: both;
 overflow: auto;
}

.child_div {
 background: black;
 color: white;
 width: 50%;
 transform: translate(-50%, -50%);
 position: absolute;
 top: 50%;
 left: 50%;
 padding: 20px;
 overflow: auto;
 font-family: Arial;
 text-transform: uppercase;
}

See jsfiddle

Create Custom Filter in Twig Inside Slim Framework

As we know twig is the most powerful, fastest, secured, modern templating engine. It comes with a lot’s of built-in features like block, extends, import, filter etc (see the reference docs). Also, it has the option to add the custom filter based on your need. So the developers can create their own filter based on their needed. This article will help you to do that. Here I am using Twig with Slim framework (version 3.X).

Create Custom Filter in Twig

An example Custom Filter:

https://gist.github.com/sohelrana820/be49697a0b246ba7fc88d27f5a9719dc

From the above snippet, you can see a filter is created called ‘twig_custom_filter‘ and then added that into the twig environment.  To use this filter into view just call it. (e.g. {{some_variable | twig_custom_filter}})

 

Getting Website’s Network Information in PHP

Sometimes we need to know website’s network information while we developing an application. Here I have included a code snippet for getting network information of a website (domain).

https://gist.github.com/sohelrana820/33db071427e14d571e9f9ff857a00df5

You can use this snippet for getting network information of a website.