Skip to content

Instantly share code, notes, and snippets.

View chabibnr's full-sized avatar
🏠
Working from home

Chabib Nurozak chabibnr

🏠
Working from home
View GitHub Profile
@chabibnr
chabibnr / autoreload.js
Created July 16, 2021 01:35
Autoreload in time
function AutoReload(times){
setInterval(function (){
let now = new Date();
let hour = (now.getHours() < 10 ? '0' : '')+now.getHours();
let minute = (now.getMinutes() < 10 ? '0':'' )+now.getMinutes();
let second = (now.getSeconds() < 10?'0':'') + now.getSeconds();
if(times.indexOf(`${hour}:${minute}:${second}`) != -1){
window.location.reload();
}
}, 1000);
<?php
namespace admin\widgets;
use Yii;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use yii\helpers\Html;
/**
* Class Menu
* Theme menu widget.
@chabibnr
chabibnr / view.php
Created December 5, 2019 04:43
Yii - enter as tab
$JS = <<<JS
$('body').on('keydown', 'input, select', function(e) {
if (e.key === "Enter") {
var self = $(this), form = self.parents('form:eq(0)'), focusable, next;
focusable = form.find('input,a,select,button,textarea').filter(':visible');
next = focusable.eq(focusable.index(this)+1);
if (next.length) {
next.focus();
} else {
form.submit();
@chabibnr
chabibnr / FavoriteMenu.dart
Created July 30, 2019 07:33
Temp Delete view
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:submission_4/database/database_helper.dart';
import 'package:submission_4/page/detail_page.dart';
class FavoriteMenu extends StatefulWidget {
final String foodId;
final String foodName;
final String foodImages;
final String locationPage;
<?php
/**
* Class ApiController
*
* File Location : application/core/ApiController.php
*
* @property CI_Input $input
* @property CI_Output $output
*/
@chabibnr
chabibnr / AuthLibrary.js
Created March 21, 2018 15:31
Implementasi pada aYom
'use strict';
import {AsyncStorage} from 'react-native';
let Auth = {
async getIsLogin(){
try {
let isLogin = await AsyncStorage.getItem("@SESSION:isLogin");
return '1' === isLogin;
}catch(err){
@chabibnr
chabibnr / client
Created December 16, 2017 09:31
Socket
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
<iframe src="http://localhost:8087" height="300" width="200"></iframe>
@chabibnr
chabibnr / index.html
Created November 26, 2017 14:51
jQuery plugin terbilang
<html>
<head>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script type="text/javascript" src="ss.js"></script>
<script type="text/javascript">
$(function () {
$(".test").terbilang();
<?php
namespace app\components;
use yii\web\View;
/**
* Class Controller
* @package app\components
* @author chabib nurozak <[email protected]>
* @version 1
public function actionExportExcel($id) {
$kuesioner = \app\models\Kuesioner::find()->where(['id' => $id])->one();
$sqlProyek = "SELECT * FROM proyek WHERE id = '" . $kuesioner->proyek . "' ";
$rowSqlProyek = Yii::$app->db->createCommand($sqlProyek)->queryOne();
$filename = 'Indosurvey - Export Kuesioner ( ' . $kuesioner->judul_kuesioner . ' ) ' . date('Y-m-d') . '.xlsx';
$columnName = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q'];
$column[] = ["No","Judul Kelompok","Pertanyaan","Kolom","Jenis","Opsi","Tanggal dibuat","Tanggal diupdate","Urutan","Min","Max","Default","Keterangan","Wajib","Score", "Pertanyaan Selanjutnya", ""];