Skip to content

Instantly share code, notes, and snippets.

View jenalgit's full-sized avatar
💭
I may be slow to respond. Lagi sibuk soalnya,,, sibuk ngopi 💃

jenal jenalgit

💭
I may be slow to respond. Lagi sibuk soalnya,,, sibuk ngopi 💃
View GitHub Profile
@jenalgit
jenalgit / AccessBehavior.php
Created October 14, 2018 11:55 — forked from r3verser/AccessBehavior.php
Yii2 Redirects all users to login (or any) page if not logged in, but allow access to some pages (like signup, password recovery etc.)
<?php
/*
* In configuration file
* ...
* 'as AccessBehavior' => [
* 'class' => 'app\components\AccessBehavior',
* 'allowedRoutes' => [
* '/',
* ['/user/registration/register'],
@jenalgit
jenalgit / Forms PopUp Yii2
Created October 11, 2018 02:37 — forked from sonifir/Forms PopUp Yii2
Forms PopUp Yii2
\*-----view----*/
use yii\bootstrap\modal;
\*-----id'=>'modalButton' untuk mengambil id dari js/main.js yang sudah di definisikan di asset----*/
<?= Html::button('Create Kodepos', ['value'=>url::to('index.php?r=kodepos/create'),'class' => 'btn btn-success','id'=>'modalButton']) ?>
\*----untuk membuat header kodepos di atas form popup dengan ukuran <h4></h4>-----*/
<?php
Modal::begin([
'header'=>'<h4>KodePos</h4>',
@jenalgit
jenalgit / controller
Created September 21, 2018 01:20 — forked from rakibroni/controller
CSV Import to MySql Database With Codeigniter
public function inportResult() {
/* echo '<pre>';
print_r($_FILES);
exit; */
$config['upload_path'] = 'upload';
$config['allowed_types'] = 'text/plain|text/anytext|csv|text/x-comma-separated-values|text/comma-separated-values|application/octet-stream|application/vnd.ms-excel|application/x-csv|text/x-csv|text/csv|application/csv|application/excel|application/vnd.msexcel';
$this->load->library('upload', $config);
@jenalgit
jenalgit / gist:dd692625f8110819c21583e842384a23
Created September 1, 2018 09:57 — forked from jhonsore/README.md
Upload an Image from camera or gallery in WebView.
//Found on: https://stackoverflow.com/questions/15725814/upload-an-image-from-camera-or-gallery-in-webview
private ValueCallback<Uri> mUploadMessage;
private Uri mCapturedImageURI = null;
private ValueCallback<Uri[]> mFilePathCallback;
private String mCameraPhotoPath;
private static final int INPUT_FILE_REQUEST_CODE = 1;
private static final int FILECHOOSER_RESULTCODE = 1;
@jenalgit
jenalgit / .jsbeautifyrc
Created August 23, 2018 03:08 — forked from wzup/.jsbeautifyrc
.jsbeautifyrc file example
{
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "dust"],
@jenalgit
jenalgit / Function.Date-Format-Conversion.php
Created August 21, 2018 09:24 — forked from mcaskill/Function.Date-Format-Conversion.php
PHP : Translate date/time format between `date()` and `strftime()`
<?php
/**
* Convert date/time format between `date()` and `strftime()`
*
* Timezone conversion is done for Unix. Windows users must exchange %z and %Z.
*
* Unsupported date formats : S, n, t, L, B, G, u, e, I, P, Z, c, r
* Unsupported strftime formats : %U, %W, %C, %g, %r, %R, %T, %X, %c, %D, %F, %x
*
@jenalgit
jenalgit / gist:12acc47e1da96fac82581754fe40b635
Created August 21, 2018 08:31 — forked from MauMaGau/gist:2579601
PHP: video conversion script
<?php
// Run from the command line, so we'll grab arguments from there
// input arguments: 0=>script, 1=>file_name, 2=>temp_file
$file_name = $argv[1];
$temp_file = $argv[2];
$uploads = '/opt/lampp/htdocs/user_uploads/';
// Set up file location strings
@jenalgit
jenalgit / Rupiah.as
Created July 7, 2018 09:26 — forked from faisalman/Rupiah.as
Konversi Angka ke format Rupiah & vice versa (C#, PHP, JavaScript, ActionScript 3.0)
package
{
/**
* ActionScript 3.0 Code Snippet
* Convert Number to Rupiah & vice versa
* https://gist.github.com/845309
*
* Copyright 2011-2012, Faisalman
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
@jenalgit
jenalgit / select2-cascade.js
Created May 8, 2018 08:28 — forked from ajaxray/ select2-cascade.js
Making Select2 (4.x) list boxes cascading / dependent. Options of a select2 list box will be loaded/refreshed by ajax based on selection of another select2 list box.
/**
* A Javascript module to loadeding/refreshing options of a select2 list box using ajax based on selection of another select2 list box.
*
* @url : https://gist.github.com/ajaxray/187e7c9a00666a7ffff52a8a69b8bf31
* @auther : Anis Uddin Ahmad <anis.programmer@gmail.com>
*
* Live demo - https://codepen.io/ajaxray/full/oBPbQe/
* w: http://ajaxray.com | t: @ajaxray
*/
var Select2Cascade = ( function(window, $) {

[abc] A single character: a, b or c
[^abc] Any single character but a, b, or c
[a-z] Any single character in the range a-z
[a-zA-Z] Any single character in the range a-z or A-Z
^ Start of line
$ End of line
\A Start of string
\z End of string
. Any single character
\s Any whitespace character