Skip to content

Instantly share code, notes, and snippets.

@woody180
woody180 / money_format.php
Created February 15, 2024 08:25
money_format function
<?php
/*
That it is an implementation of the function money_format for the
platforms that do not it bear.
The function accepts to same string of format accepts for the
original function of the PHP.
(Sorry. my writing in English is very bad)
@woody180
woody180 / responsive.js
Last active January 29, 2023 17:02
Inline responsiveness
/*
* add attributes like in the example
* data-responsive="max-width[100]; style[color: ...; font-size: ...;]"
*/
document.querySelectorAll('[data-responsive]').forEach(elem => {
const str = elem.getAttribute('data-responsive');
const match = str.match(/max-width[\s+]?\[(.*?)\]\;/g);
const maxWidth = match[0].match(/\[(.*?)\]/)[1];
const styles = str.match(/style[\s+]?\[(.*?)\]/)[1];
@woody180
woody180 / google_xml_sitemap_generator.php
Last active January 29, 2023 17:02
Google Sitemap Generator
<?php
require_once 'functions.php';
require_once 'rb-mysql.php';
///////////////////////// SETUP /////////////////////////
date_default_timezone_set('Asia/Tbilisi');
$baseurl = 'http://localhost:3000';
$dbuser = 'root';
$dbpassword = '';
@woody180
woody180 / library.php
Last active January 30, 2021 11:01
Codeigniter 4 helper functions set
<?php namespace App\Helpers;
class Library {
// Page not found
public static function notFound($params = ["code" => 404, "url" => NULL, "text" => NULL]) {
$code = $params["code"] ?? 404;
$url = $params["url"] ?? NULL;
$text = $params["text"] ?? 'Sorry, but the page you are looking for is not found. Please make sure you have typed the correct url.';
/*
Arguments list
1. class to watch
2. event type
3. callback
*/
UIkit.util.on('.uk-search-default', 'click', e => console.log(e.target.parentElement))