Skip to content

Instantly share code, notes, and snippets.

Simon Asika asika32764

Block or report user

Report or block asika32764

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@asika32764
asika32764 / php-base-path.php
Created Jun 1, 2019
Very simple way to get PHP URL path with subfolder.
View php-base-path.php
<?php
define('APP_ROOT', __DIR__); // Change this to root dir.
define('HTTP_TYPE', (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] === 443 ? 'https' : 'http');
define('HTTP_ROOT', $_SERVER['HTTP_HOST']);
define('BASE_URL', HTTP_TYPE . '://' . HTTP_ROOT . substr(APP_ROOT, strlen($_SERVER[ 'DOCUMENT_ROOT' ])) . '/');
@asika32764
asika32764 / .htaccess-prevent-php-access.conf
Created May 26, 2019
.htaccess to prevent php access except index.php
View .htaccess-prevent-php-access.conf
<Files *.php>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files index.php>
Order Allow,Deny
Allow from all
</Files>
View vue-bootstrap-datetimepicker.js
Vue.directive('calendar', {
inserted(el, binding) {
// :v-calendar="{ format: 'YYYY-MM-DD HH:mm:ss' }"
const options = Object.assign({
// Some default options
// Use FontAwesome icons
icons:{
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
View vue-select2-directive.js
function updateFunction (el, binding) {
Vue.nextTick(function () {
// :v-select2="{ options... }"
let options = binding.value || {};
// set up select2
$(el).select2(Object.assign({}, {
// Default options
}, options))
.on("select2:select select2:unselect", (e) => {
@asika32764
asika32764 / url-parsing.js
Created Dec 6, 2018
Javascript URL parsing regex
View url-parsing.js
const regex = /^((?<scheme>[^:\/?#]+):)?(\/\/(?<authority>(?<domain>[^\/?#:]*)(:(?<port>[0-9]*))?))?((?<path>[^?#]*)\\?)?((?<query>([^#]*)))?(#(?<fragment>(.*)))?/;
'foo://example.com:8042/over/there?name=ferret#nose'.match(regex);
/* Result:
authority: "example.com:8042"
domain: "example.com"
fragment: "nose"
path: "/over/there"
port: "8042"
@asika32764
asika32764 / polymer-slot-without-shadowdom.js
Created Apr 7, 2018
Polymer.Element without ShadowDOM but support slots
View polymer-slot-without-shadowdom.js
class LightDom extends Polymer.Element {
_attachDom(dom) {
const slots = dom.querySelectorAll('slot[name]');
slots.forEach((slot) => {
const name = slot.getAttribute('name');
const tmpl = this.querySelector(`[slot=${name}]`);
if (tmpl) {
@asika32764
asika32764 / Install Composer using MAMP's PHP.md
Created Feb 8, 2018 — forked from irazasyed/Install Composer using MAMP's PHP.md
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management
View Install Composer using MAMP's PHP.md

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php
@asika32764
asika32764 / joomla-often-used-events.php
Last active Apr 29, 2019
Joomla often used events example
View joomla-often-used-events.php
<?php
/**
* @package {ORGANIZATION}.Plugin
* @subpackage system.plg_flower
* @copyright Copyright (C) 2012 {ORGANIZATION}.com, Inc. All rights reserved.
* @license GNU General Public License version 2 or later.
*/
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Factory;
View dompdf-example.php
<?php
$filename = 'pdf-download';
$options = new \Dompdf\Options;
$options->set('isRemoteEnabled', true);
$dompdf = new \Dompdf\Dompdf($options);
$dompdf->set_option('defaultFont', 'droidsansfallback');
$dompdf->set_option('isFontSubsettingEnabled', true);
You can’t perform that action at this time.