Skip to content

Instantly share code, notes, and snippets.

View sheillendra's full-sized avatar

suryana sheillendra

  • Gorontalo Indonesia
View GitHub Profile
-- table
CREATE TABLE public.employee
(
id integer,
no_urut integer,
parent_id integer,
name character varying COLLATE pg_catalog."default"
);
-- query
@sheillendra
sheillendra / gist:c8bde5cc630c21da6ef3699155d9069a
Created August 15, 2018 02:01 — forked from perusio/gist:1326701
Mobile device detection in Nginx with just 7 lines of configuration
### Testing if the client is a mobile or a desktop.
### The selection is based on the usual UA strings for desktop browsers.
## Testing a user agent using a method that reverts the logic of the
## UA detection. Inspired by notnotmobile.appspot.com.
map $http_user_agent $is_desktop {
default 0;
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule
~*spider|crawl|slurp|bot 1; # bots
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes
@sheillendra
sheillendra / yii2 oracle schema without quote
Last active February 25, 2019 01:05
Yii2 oracle without quote in table and column name will effect to all
<?php
namespace common\components\db\oci;
/**
* I'm using Yii2 Version 2.0.15.1
*
* add this to db component config :
* 'db' => [
* #...
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace console\controllers;
@sheillendra
sheillendra / create_code.php
Last active November 11, 2016 06:40
Generate increment number 1 - 67,599,999 to AB12345 and can shuffle the number as template
<?php
function getCode($num) {
// $string1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
// $string2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
// $string3 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
// $string4 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
// $string5 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
// $string6 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
// $string7 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
<?php
function getLevel($n) {
for ($i = 1; $i < 12; $i++) {
if ($n <= getTopLevel($i)) {
break;
}
}
return $i;
}
@sheillendra
sheillendra / gist:331f64e2364be877831164fda1fef9a6
Last active November 8, 2016 17:43
uploaded file save as image with ratio
<?php
namespace common\components;
use Yii;
use yii\imagine\Image;
/**
* descriptcion class and example to use here
*
@sheillendra
sheillendra / TabelA
Created June 27, 2016 03:38
Yii2 Nested Relation Model
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "tabel_a".
*
* @property integer $id
@sheillendra
sheillendra / README.md
Created January 11, 2016 01:59
fresh block