Skip to content

Instantly share code, notes, and snippets.

View aufa's full-sized avatar

NAWA aufa

View GitHub Profile
@aufa
aufa / Aufa\Gist\Component\DataStorage.php
Created September 18, 2016 16:10
(Data Storage Object) Safely Save & Serve
<?php
namespace Aufa\Gist\Component;
/**
* Class DataStorage
* @package Aufa\Gist\Component
*
* add backslash to use default core function - to avoid user create new functions instead of
*/
class DataStorage implements \ArrayAccess, \Serializable, \Countable, \JsonSerializable
@aufa
aufa / App.php
Created September 14, 2016 16:22
Creating Simple BenchMark Collection on Slim 3
<?php
/**
* Example
*/
namespace MyNameSpace;
use Slim\App as Slim;
use Pentagonal\Component\Slim\BenchMark;
/**
@aufa
aufa / contoh.php
Last active September 13, 2016 19:51
<?php
$database = \MyNameSpace\ExamDB::create(
'mysql',
[
'dbuser' => 'root',
'dbpass' => 'password',
'dbname' => 'test',
'host' => 'localhost'
],
true // debug true throwed if error
@aufa
aufa / ExamDB.php
Last active September 13, 2016 19:53
Database Object Class Example
<?php
/**
* $db = ExamDB::create('driver', [
* 'dbuser' => 'user', ------. For Sqlite allowed empty
* 'dbpass' => 'pass', ------.
* 'port' => 3306, ------ // allowed empty to use default port
* 'dbname' => 'database_name',
* 'attributes' => [
* PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC // PDO Attribute
* ]
@aufa
aufa / .htaccess
Last active June 9, 2016 11:14
Upload to your directory that not allowed to exec behaviour script (apache only)
# Deny First
Deny from all
# Does not allow access executable files
# Allow only if not an executable / static resource
# that allow to be access
# note :
# ?i: = hat means incase sensitive
# (?!( = start except of current regex
# Below setting is affected to :
@aufa
aufa / MY_Config.php
Last active April 14, 2019 19:00
Prevent Visitor Accessed Direct Controller & Fix Main Url on Code Igniter config base url not set
<?php
/**
* Hackie of CI 3 Core URL Fix Sanitized
* Automation detect base url
* @pentagonal
*/
if (!class_exists('CI_Config')) {
return;
}
### Keybase proof
I hereby claim:
* I am aufa on github.
* I am nawa (https://keybase.io/nawa) on keybase.
* I have a public key whose fingerprint is 8697 D389 2DFC 5690 E501 B237 F005 9FF1 26BF 7E64
To claim this, I am signing this object:
/**
* Minify CSS
* @param string css text
* @return sting minified css text
* @author awan <nawa@yahoo.com>
*/
function minifyCSS(text)
{
// check if css is string values
if (typeof text != 'string') {
@aufa
aufa / Filter.php
Created December 28, 2015 04:35
PHP Filter Helper
<?php
/**
* HTML Output Filter
* @author awan <nawa@yahoo.com>
*/
/**
* Entities the Multibytes string
*
* @param string $string the string to detect multibytes
@aufa
aufa / util.js
Last active September 15, 2016 01:23
Minimal Helper Javascript Utility
/*! Util JS
* Small File javascript function
* collection Without jQuery as User Authentication Helper
* @author awan <nawa (at) yahoo (dot) com>
*
-------------------------------- */
/**
* global zxcvbn
* Get scores of password meter