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 / README.md
Last active Sep 19, 2019
在 Windows 中用 WinRAR.exe 實現 zip & unzip 指令
View README.md

在 Windows 中用 WinRAR.exe 實現 zip & unzip 指令

安裝方式

首先你需要安裝 WinRAR,然後在任何你想放指令的位置(例如 C:\bin),將環境變數指向到這邊來。

接著下載這兩個 bat 檔,放在你環境變數指向的位置即可。

使用方式

View mysql-rand-between-two-values.sql
ROUND((RAND() * (max-min))+min)
@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 AESAlgorithm.java
/*
* Copyright 2007 Richard Chen
* mail: richardchen0310@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@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 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) => {
View opencart-admin-config.php
<?php
// Get Base URI
$baseUri = str_replace($_SERVER['DOCUMENT_ROOT'], '', dirname($_SERVER['SCRIPT_FILENAME']));
$http = str_replace(array('/', '\\'), '/', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . $baseUri . '/');
$catalog = explode('/', $http);
array_pop($catalog);
array_pop($catalog);
$catalog = implode('/', $catalog) . '/';
View ajax-helper.js
function AjaxHelper() {
this.ajax = function(url, type, dataType, data, callback) {
$.ajax({
url: url,
type: type,
dataType: dataType,
data: data,
success: callback,
error: function(xhr, errorType, error) {
alert('Ajax request error, errorType: ' + errorType + ', error: ' + error)
You can’t perform that action at this time.