Skip to content

Instantly share code, notes, and snippets.

@A973C
A973C / flextext-responsive-font-size-based-on-container-div-size.markdown
Created August 28, 2021 09:02
FlexText - Responsive font size based on container DIV size
@A973C
A973C / getip.php
Created July 9, 2021 09:29
Get client IP address
// Source: https://stackoverflow.com/a/28217316/15939309
function get_ip_address() {
// Check for shared Internet/ISP IP
if (!empty($_SERVER['HTTP_CLIENT_IP']) && validate_ip($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
}
// Check for IP addresses passing through proxies
@A973C
A973C / index.html
Created June 3, 2021 17:11
How to handle loading of images that may not exist?
<img src="http://example.com/non-existent-image.jpg" onerror="this.onerror=null;this.src='http://example.com/existent-image.jpg';" />
<!-- Source: https://blog.imagekit.io/how-to-handle-loading-images-that-may-not-exist-on-your-website-92e6c3c6ea63 -->
@A973C
A973C / notepad.markdown
Last active May 21, 2021 04:51
Set a browser tab as notepad

Type the following url in the desired browser tab:
data:text/html, <html contenteditable>

Or you can customize it too:
data:text/html,

@A973C
A973C / apple-tv-word-rotation.markdown
Created May 20, 2021 09:37
Apple TV - Word Rotation
@A973C
A973C / index.html
Created May 17, 2021 07:07
Center vertically #css
<style>
.element {
margin-top: 50vh;
transform: translateY(-50%);
}
</style>
<div class="element">center ?</div>
@A973C
A973C / index.php
Created May 16, 2021 05:03
Pretty print array php
<?php
print("<pre>".print_r($array_data,true)."</pre>");
?>
@A973C
A973C / index.php
Created May 5, 2021 08:29
Two dimensional array #php
<?php
$array = array(
0 => array(
'name' => 'John Doe',
'email' => 'john@example.com'
),
1 => array(
'name' => 'Jane Doe',
'email' => 'jane@example.com'
@A973C
A973C / css-fullscreen-pseudo-class.markdown
Last active May 11, 2021 08:13
CSS :fullscreen Pseudo Class
@A973C
A973C / css-grid-layout.markdown
Last active April 12, 2021 15:27
CSS Grid Layout