Skip to content

Instantly share code, notes, and snippets.

View piotr-cz's full-sized avatar
👋

Piotr piotr-cz

👋
View GitHub Profile
@piotr-cz
piotr-cz / config.xml
Last active April 28, 2022 11:41
Cordova splash screens hook, with Android 9-Patch generation
<?xml version='1.0' encoding='utf-8'?>
<widget>
<!-- ... -->
<hook src="scripts/cordova/media/splashscreens.js" type="before_platform_add" />
</widget>
@piotr-cz
piotr-cz / CustomSelect2Adapter.js
Last active November 28, 2023 11:37
Select2 ArrayAdapter to keep options in order they were selected
// Tested on Select2 v4.0.2
// Init
var $select = jQuery('#my-select');
var select2Options = {
multiple: true
};
// Add decorator adapter
if (keepOptionsOrder) {
@piotr-cz
piotr-cz / deploy.json
Last active May 3, 2018 09:05
Gulp - FTP deploy updated files
{
"env": {
"staging": {
"ftpConfig": {
"host": "xxx",
"user": "xxx",
"pass": "xxx"
},
"path": {
"local": "./public",
@piotr-cz
piotr-cz / helper.php
Last active January 2, 2016 14:19
Joomla-CMS: JInstallerHelper::downloadPackage patch to encode url query values
/**
* JInstallerHelper::downloadPackage patch to encode redirect url query values.
*
* File Locations:
* - J3.2: /libraries/cms/installer/helper.php
* - J2.5: /libraries/joomla/installer/helper.php
*
* For performance reasons (assuming that initial $url is valid),
* this code can be moved just under the `302 == $response->code` check.
*/
@piotr-cz
piotr-cz / gist:6635698
Created September 20, 2013 10:28
Test usage of [com_ajax](https://github.com/joomla/joomla-cms/pull/1960). Please note I don't know how the jQuery response looks like, this is based on guess.
$.ajax({
type : 'POST',
data : request,
// Got HTTP response code 200
success: function (response)
{
switch (this.data.request.format)
{
// Handling JSON format
@piotr-cz
piotr-cz / JHtmlEmail
Last active December 19, 2015 07:09
Updated JHtmlEmail. Changes: - optimized javascript code - when javascript is disabled, message is now shown in <noscript /> tag - fixed bug in XHTML documents - added placeholder character to show when javascript is disabled
<?php
/**
* @package Joomla.Libraries
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Removes the admin menu item for a given component
*
* This method was pilfered from JInstallerComponent::_removeAdminMenus()
* /libraries/joomla/installer/adapters/component.php : _removeAdminMenus
*
* @param int $id The component's #__extensions id
*
* @return bool True on success, false on failure
*
@piotr-cz
piotr-cz / Backbone-fw_agnostic.js
Created December 7, 2011 10:45
Backbone.js Framework agnostic
// Backbone.js 0.5.3
// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://documentcloud.github.com/backbone
(function(){
// Initial Setup
// -------------