Skip to content

Instantly share code, notes, and snippets.

@kazeno
kazeno / docker-compose.yml
Created Nov 13, 2021
Docker Compose files for TTRSS on Azure Pipelines + App Service for Containers
View docker-compose.yml
#run file
version: '3.2'
services:
app:
image: YOUR_APP_IMAGE_URL_HERE
restart: unless-stopped
environment:
TTRSS_DB_HOST
TTRSS_DB_NAME
View workdaysdatediff_declaration.sql
DELIMITER $$
CREATE FUNCTION WORKDAYSDATEDIFF (date1 DATE, date2 DATE, workdays VARCHAR(7))
RETURNS INT DETERMINISTIC
/* Calculates working days between 2 dates, work days are supplied as a string with numbers from 0-6 corresponding to WEEKDAY, for example Mon-Fri would be '01234' */
BEGIN
DECLARE date_start DATE;
DECLARE date_end DATE;
DECLARE total_days INT;
DECLARE weeks INT;
DECLARE start_weekday INT;
View issue14041.php
<?php
/**
* Proof of concept of Prestashop Github Issue 14041 https://github.com/PrestaShop/PrestaShop/issues/14041
* Put this code inside modules/issue14041/issue14041.php and install the module, it will replicate the issue any time the module's configuration is accessed.
*/
class Issue14041 extends Module
{
public function __construct()
@kazeno
kazeno / AdminThemesController.php
Created Sep 13, 2016
Prestashop Preferences > Themes blank screen fix override
View AdminThemesController.php
<?php
class AdminThemesController extends AdminThemesControllerCore
{
public function init()
{
$this->logged_on_addons = false;
parent::init();
}
}
@kazeno
kazeno / recursive_sort_yii.php
Created Sep 13, 2016
Sort objects hierarchically in recursive multidimensional arrays in Yii
View recursive_sort_yii.php
<?php
$sections = Section::model()->findAll(
array('order'=>'parent ASC NULLS FIRST,"order"')); //PostgreSQL FTW
$entryRecords = array();
$entryPaths = array();
foreach ($sections as $section) {
$section->children = array();
$entryPaths[$section->id] = array();
if ($section->parent === NULL) {
$entryRecords[$section->order] = $section;
@kazeno
kazeno / recursive_sort_generic.php
Last active Sep 13, 2016
Sort objects hierarchically in recursive multidimensional arrays
View recursive_sort_generic.php
<?php
$entries = yourGetEntriesFromDbFunction(); //The array with our retrieved DB entries
$entryRecords = array(); //Our hierarchy will be created in this array
//We will track the path of each entry here, with an array
//for each entry containing the ids of all its ancestors:
$entryPaths = array();
foreach ($entries as $entry) {
//Create a new key inside each entry to store its children:
$entry['children'] = array();
$entryPaths[$entry['id']] = array(); //Make a space for the path of the entry
@kazeno
kazeno / jquery_prop_1.6.js
Created Sep 13, 2016
Retrofitting jQuery prop() for jQuery > 1.6
View jquery_prop_1.6.js
if (typeof jQuery.fn.prop != 'function') {
jQuery.fn.prop = jQuery.fn.attr;
}