Skip to content

Instantly share code, notes, and snippets.

View rwaddin's full-sized avatar
🖥️
Freelance Full-stack web developer

addin rwaddin

🖥️
Freelance Full-stack web developer
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@rwaddin
rwaddin / set active nav
Created May 14, 2020 07:50
Function Menu CI3 case panel adminLTE 2.4.8
if (! function_exists('nav_active'))
{
function nav_active($type = false, $uri = false, $nav = false, $with_class = false)
{
if ($type AND $uri AND $nav) {
switch ($type) {
# just compare 2 string
# use nav_active("one",foo", "foo")
case "one":
@rwaddin
rwaddin / json-create.php
Created May 19, 2020 04:42
Create file json use php
<?php
// Data 1
$data [] = array(
'no' => 1,
'nama' => 'Rudi',
'alamat' => 'Nganjuk'
);
// Data 2
$data [] = array(
@rwaddin
rwaddin / json-read.php
Created May 19, 2020 04:43
Read a file json with php
<?php
// File json yang akan dibaca (full path file)
$file = "anggota.json";
// Mendapatkan file json
$anggota = file_get_contents($file);
// Mendecode anggota.json
$data = json_decode($anggota, true);
@rwaddin
rwaddin / json-insert.php
Created May 19, 2020 04:44
Insert data to file json with php
<?php
// File json yang akan dibaca
$file = "anggota.json";
// Mendapatkan file json
$anggota = file_get_contents($file);
// Mendecode anggota.json
$data = json_decode($anggota, true);
@rwaddin
rwaddin / json-update.php
Created May 19, 2020 04:45
Update file json with php
<?php
// File json yang akan dibaca
$file = "anggota.json";
// Mendapatkan file json
$anggota = file_get_contents($file);
// Mendecode anggota.json
$data = json_decode($anggota, true);
@rwaddin
rwaddin / json-delete.php
Created May 19, 2020 04:45
Delete data file json with php
<?php
// File json yang akan dibaca
$file = "anggota.json";
// Mendapatkan file json
$anggota = file_get_contents($file);
// Mendecode anggota.json
$data = json_decode($anggota, true);
@rwaddin
rwaddin / swal-confirm.js
Created May 19, 2020 05:40
Use sweetalert confirm in v 7x. if you use sweetalert v8x must use Swal.fire()
swal({title:"Sukses", text :"Setting berhasil dihapus", type : "success", showCancelButton : true}).then((result)=>{
if (result.value) {
location.reload();
}
})
@rwaddin
rwaddin / validasi-email.php
Created May 19, 2020 09:02
To validate email with php
<?php
# sample 1
function isValidEmail($email){
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}
# sample2
function isValidEmail($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL)
&& preg_match('/@.+\./', $email);
@rwaddin
rwaddin / adminLTE - Custom Tabs.html
Last active May 27, 2020 06:39
i use at adminLTE 2.4.8
<div class="nav-tabs-custom">
<ul class="nav nav-tabs pull-right">
<li class="active"><a href="#tab_1-1" data-toggle="tab">Tab 1</a></li>
<li><a href="#tab_2-2" data-toggle="tab">Tab 2</a></li>
<li><a href="#tab_3-2" data-toggle="tab">Tab 3</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
Dropdown <span class="caret"></span>
</a>
<ul class="dropdown-menu">