Skip to content

Instantly share code, notes, and snippets.

View IhwanID's full-sized avatar

Ihwan IhwanID

View GitHub Profile
@IhwanID
IhwanID / sample-code-1.php
Created August 2, 2018 22:45
Sample code of if else, switch case, while, do while, for and foreach
<?php
$umur = 17;
// if else statement
if ($umur < 16){
echo "Wah Masih muda ya!";
}elseif ($umur = 17) {
echo "Umur kamu 17, yang semangat belajarnya";
} else {
@IhwanID
IhwanID / sample-code-2.php
Created August 2, 2018 23:10
sample code of show database from mysql phpmyadmin
<?php
//kodingan koneksi
$mysqli = mysqli_connect("localhost", "root", "", "sekolah");
//get database
$result = mysqli_query($mysqli, "SELECT * FROM siswa ORDER BY id DESC");
?>
@IhwanID
IhwanID / sample-code-3.php
Created August 3, 2018 23:10
sample code of function in php
<?php
function ucapSalam() {
echo "Assalamualaikum";
}
//cara panggil function
ucapSalam();
function namaKeluarga($namaAwal) {
@IhwanID
IhwanID / create_post.php
Last active August 31, 2018 20:45
sample code of create post in workshop blog php
<?php
//session_start();
//if(! isset($_SESSION['loggedin']))
//exit('akses dilarang, silahkan login dulu');
include_once('config.php');
$judul = "Tambah Post";
<?php
//session_start();
//if(! isset($_SESSION['loggedin']))
//exit('akses dilarang, silahkan login dulu');
include_once('config.php');
$judul = "Edit Post";
<?php
//session_start();
//if(! isset($_SESSION['loggedin']))
//exit('akses dilarang, silahkan login dulu');
include_once('config.php');
$id = $_GET['id'];
<?php
session_start();
include_once('config.php');
$judul = "Login";
$subjudul = "";
$url_banner = "assets/img/home-bg.jpg";
if(isset($_POST['submit'])){
@IhwanID
IhwanID / Converter.kt
Created October 9, 2018 17:38
Format Rupiah dengan kotlin
class Converter {
companion object {
fun rupiah(number: Double): String{
val localeID = Locale("in", "ID")
val numberFormat = NumberFormat.getCurrencyInstance(localeID)
return numberFormat.format(number).toString()
}
}
}
@IhwanID
IhwanID / lifecycle.java
Created October 15, 2018 13:40
java android lifecycle
package id.ihwan.bpr_training_java;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@IhwanID
IhwanID / latihan1.c
Last active October 20, 2018 10:34
Latihan menggunakan Bahasa C di Kampus STMIK Sumedang
#include <stdio.h>
int main(void){
printf("Welcome to C!\n");
int angka1;
int angka2;
int jumlah;
int hasilKali;