Skip to content

Instantly share code, notes, and snippets.


Simon Asika asika32764

View GitHub Profile
asika32764 /
Last active Jan 9, 2020
PHP - BIG SQL File Splitter as Iterator

SQL Splitter as Iterator

This is a class that can split BIG SQL file or string as iterator so that can help us save memory when importing SQL to database.

Composer version see here:


$it = SqlSplitter::splitFromFile(__DIR__ . '/path/to/db.sql');
asika32764 / php-base-path.php
Created Jun 1, 2019
Very simple way to get PHP URL path with subfolder.
View php-base-path.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('BASE_URL', HTTP_TYPE . '://' . HTTP_ROOT . substr(APP_ROOT, strlen($_SERVER[ 'DOCUMENT_ROOT' ])) . '/');
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
<Files index.php>
Order Allow,Deny
Allow from all
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
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 / 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>(.*)))?/;
/* Result:
authority: ""
domain: ""
fragment: "nose"
path: "/over/there"
port: "8042"
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 / Install Composer using MAMP's
Created Feb 8, 2018 — forked from irazasyed/Install Composer using MAMP's
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

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 / joomla-often-used-events.php
Last active Apr 29, 2019
Joomla often used events example
View joomla-often-used-events.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;
You can’t perform that action at this time.