As you know, with styled-component you may extend an HTML tag and define an attribute immediately. That’s very useful when you need to use a component often.
Category / Very Short Snippet
Of course, you know dangerouslySetInnerHTML attribute. This is very useful when you need to insert a custom own HTML in your page. …is React’s replacement for using innerHTML in the browser DOM. In general, setting HTML from code is risky because it’s easy to inadvertently expose your users to a cross-site scripting (XSS) attack. So, you […]
Here you’ll find some useful jQuery snippets for document loaded.
Edit your wp-config.php file, located in WordPress root folder, and add or replace define(‘WP_DEBUG’, true); In this way, WordPress will print the logs on the screen. This may be very annoying, so you would like to redirect all logs in a file. As usual, please don’t hesitate to leave any questions or comments in the […]
How to check if an element DOM exists Be careful when you wish if an element DOM exists. If you use: This method doesn’t work because jQuery will return an [Object object] even if the element doesn’t exist. We may use a couple of methods to be sure that an element exists:
How to merge one or more images
Let’s see some useful method about NSURL Return the name of a file (with or without extension) from NSURLRequest: Return the file extension from NSURLRequest: Finally, How to convert an address from NSString to NSURL and vice versa:
A simple way to create a slug:
In WordPress, you can organise the category with a relationship parent/child. This means that a single post belongs to multiple categories. Let’s see how to get the parent category of a post:
Sometimes, you may wish to check a POST variable and when it is not set then get a default value. The first approach could be: