Skip to content

Instantly share code, notes, and snippets.

View asika32764's full-sized avatar

Simon Asika asika32764

View GitHub Profile
@asika32764
asika32764 / .htaccess-prevent-php-access.conf
Created May 26, 2019 10:44
.htaccess to prevent php access except index.php
<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>
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',
@asika32764
asika32764 / vue-select2-directive.js
Created February 20, 2019 14:02
Vue Select2 Directive
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 December 6, 2018 16:37
Javascript URL parsing regex
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 April 7, 2018 20:00
Polymer.Element without ShadowDOM but support slots
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 February 8, 2018 12:39 — 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

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 April 29, 2019 06:25
Joomla often used events example
<?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;
<?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);
@asika32764
asika32764 / luna-warder-1.2.md
Created June 19, 2017 03:42
Luna & Warder 1.2 新增功能

Luna & Warder 1.2 新增功能

Luna 1.2

新增 Contact

170619-0001

前後台新增 error_extends 設定