Skip to content

Instantly share code, notes, and snippets.

@hidayat365
hidayat365 / diskon.php
Created March 12, 2012 03:26
Perhitungan Diskon
<?php
function hitung_total(&$data)
{
// hitung harga
$data['harga_total'] = $data['quantity'] * $data['harga_satuan'];
$data['nilai_diskon'] = $data['harga_total'] * $data['diskon'];
$data['harga_diskon'] = $data['harga_total'] - $data['nilai_diskon'];
// return status
// kita bisa kasih logic
@hidayat365
hidayat365 / FizzBuzz.sql
Created March 15, 2012 06:21
Fizz Buzz Solution using MySQL
select
-- logic untuk fizzbuzz
case
when baris %15 = 0 then 'FizzBuzz'
when baris %3 = 0 then 'Fizz'
when baris %5 = 0 then 'Buzz'
else baris end fizzbuzz
from (
-- generate 100 baris row dan beri nomor
select @no := @no+1 baris
@hidayat365
hidayat365 / layout.html
Created March 19, 2012 12:21
HTML Float Layout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contoh Layout</title>
<style>
p { margin: 0; }
.span-3, .span-6, .span-10, .span-23 {
float:left;
margin-right:10px;
@hidayat365
hidayat365 / oratest.php
Created April 10, 2012 04:52
Sample PHP code for Oracle Database
<?php
// connect ke oracle xe pakai easy naming
$conn = oci_connect('hr', 'hr', '//localhost/xe');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// execute query
@hidayat365
hidayat365 / oratest2.php
Created April 10, 2012 06:43
Sample PHP code for Oracle Database v2
<?php
// connect ke oracle xe pakai easy naming
$conn = oci_connect('hr', 'hr', '//localhost/xe');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// execute query
@hidayat365
hidayat365 / output.sql
Created April 12, 2012 03:37
Output MySQL
D:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
@hidayat365
hidayat365 / box.html
Created April 26, 2012 03:53
Box CSS
<style>
#container {
background-color:#FFF;
min-height:100px;
border-bottom-right-radius:10px;
border-bottom-left-radius:10px;
border-top-right-radius:10px;
border-top-left-radius:10px;
-moz-box-shadow: 0 0 5px #333;
-webkit-box-shadow: 0 0 5px #333;
@hidayat365
hidayat365 / mailer.php
Created April 30, 2012 03:42
Emailing using PEAR Mail
<?php
// require PEAR:Mail
require_once("Mail.php");
// parameter mail
$host = "ssl://smtp.google.com";
$port = 465;
$email = "your_account@gmail.com";
$pass = "your_gmail_password";
@hidayat365
hidayat365 / oophello.php
Last active October 4, 2015 02:07
Hello World OOP
<?php
/*
* contoh interface
*/
interface Printer
{
public function printOut($message);
}
@hidayat365
hidayat365 / region.html
Created May 13, 2012 16:25
HTML Region using CSS
<style type="text/css">
.page {
width: 960px;
margin: 5 auto;
}
.header {
background-color: #F00;
}
.main-wrapper {
background-color: #fff;