Skip to content

Instantly share code, notes, and snippets.

View dikiwidia's full-sized avatar
:octocat:
#OpenToWork

Moch Diki Widianto dikiwidia

:octocat:
#OpenToWork
View GitHub Profile
@dikiwidia
dikiwidia / cryptarithm.php
Created July 21, 2024 15:15
Cryptarithm with PHP (basic)
<?php
$first_crypt = "AB";
$second_crypt = "AB";
$result_crypt = "BCC";
function calc($first_crypt, $second_crypt, $result_crypt, $operator = 'add') {
$crypt_input = str_split($first_crypt . $second_crypt . $result_crypt);
$merge_input = array_unique($crypt_input);
sort($merge_input);
/*--------------------------------------------------------------------
Moch Diki Widianto - PT BUMI LANCANG KUNING PUSAKA
Soal
Cari kemungkinan banyaknya pola yang dapat ditemukan
dari pattern "ABCD"
Contoh:
"ABCDASABCDSA"
index 0 "ABCD"
@dikiwidia
dikiwidia / sequence_tree.php
Created June 20, 2022 03:39
Looping Problem Sequence Tree
<?php
$datas = [
['id'=> 1, 'parent_id' => 0, 'type' => 'HEADER', 'sequence_no' => 1],
['id'=> 2, 'parent_id' => 1, 'type' => 'OTHER', 'sequence_no' => 2],
['id'=> 3, 'parent_id' => 1, 'type' => 'OTHER', 'sequence_no' => 3],
['id'=> 4, 'parent_id' => 0, 'type' => 'HEADER', 'sequence_no' => 4],
['id'=> 5, 'parent_id' => 4, 'type' => 'OTHER', 'sequence_no' => 5],
['id'=> 6, 'parent_id' => 4, 'type' => 'OTHER', 'sequence_no' => 6],
['id'=> 7, 'parent_id' => 0, 'type' => 'HEADER', 'sequence_no' => 7],
@dikiwidia
dikiwidia / bootstrap_change_page.html
Last active December 8, 2021 08:10
Bootstrap change page with button group
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
@dikiwidia
dikiwidia / github_desktop_ubuntu.sh
Created May 16, 2021 04:30 — forked from berkorbay/github_desktop_ubuntu.md
To install Github Desktop for Ubuntu
#sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.1.0-linux1/GitHubDesktop-linux-2.1.0-linux1.deb
#sudo gdebi GitHubDesktop-linux-2.1.0-linux1.deb
# UPDATE (2021-03-05): Thanks to PaoloRanzi81's comment, the updated code is as follows https://gist.github.com/PaoloRanzi81
sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.6.3-linux1/GitHubDesktop-linux-2.6.3-linux1.deb
### Uncomment below line if you have not installed gdebi-core before
# sudo apt-get install gdebi-core
sudo gdebi GitHubDesktop-linux-2.6.3-linux1.deb
<?php
// init
$flow = [
'pertama' => 'Bismillah dan Perencanaan',
'kedua' => 'Lamaran',
'ketiga' => 'Akad dan Resepsi'
];
$status = "Lajang";
$days = 365;
$plan = true;
@dikiwidia
dikiwidia / unique_multidim_array.php
Created July 2, 2020 14:06
Sum Array Value of Duplicate Data in PHP
<?php
/* -------------------------------------------------------------------------
Penjelasan sintaks: Digunakan untuk grouping array key "serial_no" sekaligus
mengakumulasi array key "qty" dengan "serial_no" yang sama.
---------------------------------------------------------------------------*/
$array = [
['serial_no' => '009-AZ', 'name' => 'BSI COIL Z009 1000-PCE', 'qty' => 91],
['serial_no' => '009-AZ', 'name' => 'BSI COIL Z009 1000-PCE', 'qty' => 20],
['serial_no' => '009-AZ', 'name' => 'BSI COIL Z009 1000-PCE', 'qty' => 102],
['serial_no' => '049-BZ', 'name' => 'GEM COIL Z100 0900-CSE', 'qty' => 91],
@dikiwidia
dikiwidia / form.html
Created June 27, 2020 14:18
Membuat Form Sederhana dengan HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Membuat Form</title>
</head>
<body>
<form action="#" method="POST">
<p>Username:</p>
@dikiwidia
dikiwidia / koneksi.php
Created May 24, 2020 15:26
Koneksi ke Database
<?php
$ip = "localhost";
$username = "pma"; // default xampp "root"
$password = "admin123"; // default xampp ""
$database = "belajar";
$conn = new mysqli($ip,$username,$password,$database);
if ($conn->connect_errno) {
echo "Failed to connect to MySQL: " . $conn->connect_error;
exit();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tabel</title>
</head>
<body>
<table border="1" style="width: 100%;">
<thead>