PHP and money calculations

Updated: 10th January 2024
Tags: php

Please, use integer as cents, don't do my mistake, if you are using PHP.

I was shocked when discovered that php is using float and doesn't have decimal. I have a lot of code already done, so I used bcmath to get around, but if I had known this earlier, I would have used integers.

MySQL remove duplicate rows

Updated: 17th November 2023
Tags: mysql sql

[Solved] java.lang.IllegalStateException: Fragment not attached to a context

Updated: 11th October 2023
Tags: android java

Explain linux file permission like I'm Five

Updated: 2th June 2023
Tags: ubuntu linux

php get link from atom feed

Updated: 26th May 2023
Tags: php

How to read rss or atom with php

Updated: 26th May 2023
Tags: php

uajax - Universal Ajax Forms or how I created htmx killer

Updated: 10th May 2023
Tags: javascript html forms ajax

How to post to facebook page using api with plain php

Updated: 26th April 2023
Tags: php facebook

crop center and resize image using cwebp respecting aspect ratio (php)

Updated: 30th March 2023
Tags: php cwebp

bootstrap 5 hide existing modal using javascript

Updated: 30th March 2023
Tags: bootstrap5 javascript

chart.js show percentage in pie chart

Updated: 28th March 2023
Tags: javascript chart.js

Convert php array to javascript array

Updated: 28th March 2023
Tags: php javascript

[Solved] file_put_contents(/bootstrap/cache/packages.php): failed to open stream: Permission denied

Updated: 17th February 2023
Tags: laravel php ubuntu

mysql str_replace

Updated: 4th February 2023
Tags: mysql sql
UPDATE my_table SET column1 = REPLACE(column1, 'search string', 'replacement');

php echo (convert) date to RFC 3339

Updated: 3th February 2023
Tags: php
echo date(DATE_RFC3339);
//convert from other format
echo date(DATE_RFC3339, strtotime('2023-01-01 05:55:55'));

How to make dark scrollbar in custom dark theme

Updated: 30th January 2023
Tags: css

If you have toggle dark theme, you can make scrollbars and inputs also dark.

For example you have dark theme with following markup

<body data-theme="dark">

Add this css to make scrollbars and inputs dark

[data-theme=dark] {color-scheme: dark;}

How to shrink font-awesome to use only few icons

Updated: 29th January 2023
Tags: css fontawesome

Why jQuery is still needed

Updated: 20th January 2023
Tags: javascript jquery

How to change auto_increment mysql

Updated: 9th January 2023
Tags: sql mysql
ALTER TABLE my_table_name AUTO_INCREMENT = 777;

uajax - universal ajax forms

Updated: 28th December 2022
Tags: javascript