Skip to content

Instantly share code, notes, and snippets.

@arnisjuraga
arnisjuraga / Readme.md
Last active Apr 26, 2020
Codeigniter 4 install, boilerplate, configuration
View Readme.md
apt update
apt install php-intl #needed by default
php-sqlite3 #needed by default configuration for tests - uses sqlite 

composer create-project codeigniter4/appstarter myfirstproject
cd myfirstproject
composer require myth/auth:1.*@dev
@arnisjuraga
arnisjuraga / gist:a377c591bdddda17b00108beb0bad1ed
Last active Apr 15, 2020
Remove DEFINER from MySQL mysqldump tool backup file
View gist:a377c591bdddda17b00108beb0bad1ed
#
# Documented from https://stackoverflow.com/questions/9446783/remove-definer-clause-from-mysql-dumps
#
cat backupfile.sql | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | sed -e 's/DEFINER[ ]*=[ ]*[^*]*PROCEDURE/PROCEDURE/' | sed -e 's/DEFINER[ ]*=[ ]*[^*]*FUNCTION/FUNCTION/' > result.sql
#
#
#
@arnisjuraga
arnisjuraga / HTML_UnEncode.sql
Created Feb 13, 2020
Convert HTML entities to HTML code in MySQL
View HTML_UnEncode.sql
/*
Function converts encoded HTML entities back to HTML tags in pure MySQL
-- Original method: https://stackoverflow.com/a/41460016/1720476
-- @Balmiopour comment added https://stackoverflow.com/questions/3678980/is-there-a-mysql-function-to-decode-html-entities#comment71742861_41460016
Version history:
@arnisjuraga
arnisjuraga / suffixsearch.php
Last active Sep 19, 2019
Search, is array strings matches suffix of another string
View suffixsearch.php
<?php
/*
Credits: https://stackoverflow.com/a/10872110/1720476
e.g. I need to search, if given string suffix characters (starts with) "allowed" characters.
$allowed = [ 'LV', 'LT' , 'IBAN' ];
$given = 'LViban8500';
*/
@arnisjuraga
arnisjuraga / convert_twig_to_php_opencart.md
Last active Apr 3, 2020
A small script with manual steps, how to convert simple TWIG templates back to PHP markup. Used for Opencart, sequence is important. Will be updated as used for any new template.
View convert_twig_to_php_opencart.md

TODO: automated script

Regex search-replace

Static variables echo


# Strings
@arnisjuraga
arnisjuraga / 0_reuse_code.js
Created Dec 11, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.