Skip to content

Instantly share code, notes, and snippets.

View Design Patterns: Adapter vs Facade vs

The three design patterns (Adapter, Facade and Bridge) all produce the result of a clean public API. The difference between the patterns are usually due to a subtle context shift (and in some cases, a behavioural requirement).


The primary function of an Adapter is to produce a unified interface for a number of underlying and unrelated objects.

You will notice this pattern being utilised in many applications. For example, ActiveRecord (the popular Ruby ORM; object-relational mapping) creates a unified interface as part of its API but the code underneath the interface is able to communicate with many different types of databases. Allowing the consumer of the API to not have to worry about specific database implementation details.

The principle structure of this pattern is:

application2000 /
Created Jan 16, 2019
No more tedious task. Even though this little bash script is improvable It might help you out. Have a nice day!
MY_COMPOSER_BIN="$(which composer)"
for p in $(cat ${MY_COMPOSER_BIN} suggests ${MY_PACKAGE_NAME});
${MY_COMPOSER_BIN} require --dev "$p";
application2000 / edit.php
Created Jan 12, 2019 — forked from sanderpotjer/edit.php
Template override for improved Joomla article submission form
View edit.php
* @package Article Form override for Joomla 3
* @copyright Copyright (c) 2014 Sander Potjer -
* @license GNU General Public License version 3 or later
defined('_JEXEC') or die;
application2000 / f_format_text.sql
Created Nov 17, 2018
Replace part of a given text with a chosen character.
View f_format_text.sql
CREATE FUNCTION f_format_text(str VARCHAR (255), replacement VARCHAR(1), ply TINYINT(3), bias DECIMAL(5,2)) RETURNS VARCHAR(255)
DECLARE treshold INT;
SET len = LENGTH(str);
SET treshold = FLOOR(ply*bias*len);
SELECT REPLACE(str, SUBSTRING(str,treshold), REPEAT(replacement, ((len - treshold) + 1)))
application2000 / index.html
Created Jul 30, 2018
Wow! You are so Texty!!!
View index.html
<script src=""></script>
<a-text id="saymyname" position="-1 2.5 -4" value="Type to touch my heart..." color="hotpink" opacity="1.0">
<a-animation attribute="color" dur="1000" direction="alternate" easing="linear" from="rgb(255,0,0)" to="rgb(255,105,180)" repeat="indefinite"></a-animation>
application2000 / index.html
Created Jul 26, 2018
Twisted Cube Dimension
View index.html
<script src=""></script>
<a-entity id="cubes" rotation="45 45 0" position="0 1.5 -3" scale="0.5 0.5 0.5">
<a-box position="-1 1 -1"></a-box>
<a-box position="-1 1 1"></a-box>
<a-box position="-1 -1 1"></a-box>
View cube-dimension.markdown
application2000 /
Created Dec 3, 2017 — forked from jed/
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

application2000 /
Created Nov 15, 2017
Obtenez un meilleur score et limiter les pourriels. En utilisant cette astuce. Envoyer un courriel en version texte et html avec JMail api de Joomla! 3.

Envoyer un courriel en version texte et html avec l'api JMail de Joomla! 3

Je suis tombé sur ce problème et voici ce qui a fonctionné pour moi:

$mailer = JFactory::getMailer();
$mailer->CharSet  = 'UTF-8';
$mailer->Encoding = 'base64';
application2000 / 99-custom-opcache-php.ini
Created Oct 30, 2017
Using this file and adjust settings with your setup to improve php overall performance without having to change your code. For performance one should first fix his or her code before using such "fancy sugar" techniques.
View 99-custom-opcache-php.ini