Skip to content

Instantly share code, notes, and snippets.

View godamri's full-sized avatar
😶

Rian godamri

😶
  • -
  • Jakarta, Indonesia
View GitHub Profile
@godamri
godamri / country_code.json
Created March 15, 2022 20:09
country code geo
{
"ref_country_codes" : [
{
"country" : "Albania",
"alpha2" : "AL",
"alpha3" : "ALB",
"numeric" : 8,
"latitude" : 41,
"longitude" : 20
},
<html>
<head>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="XXXXXXXXXXXX.apps.googleusercontent.com">
<script>
function onSignIn(googleUser) {
console.log(googleUser.getAuthResponse().id_token)
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
<?php
$actualDiskon = 12000;
$diskon = 10000;
$diskonA = 10;
$diskonB = 10;
$realDiskonA = 100 / ($diskonA+$diskonB) * $diskonA;
$realDiskonB = 100 / ($diskonA+$diskonB) * $diskonB;
{
"success": 1,
"data": [
{
"id" : 2,
"name": "Medan"
},
{
"id" : 3,
"name": "Palembang"
<?php
/**
* @Author Rian (godamri@gmail.com)
*/
class Database
{
/*
* Database credentials
*/
private $host = '127.0.0.1';
<?php
$data = array(array("nama"=>"Budi","alamat"=>"disana"),array("nama"=>"Ayah Budi","alamat"=>"Serumah Budi"));
echo "<table>
<tr>
<th>nama</th><th>alamat</th>
</tr>";
foreach ( $data as $ind=>$orang ){
echo "<tr> <td>" . $orang['nama'] . "</td><td>" . $orang['alamat'] . "</td></tr>";
}
echo "</table>";
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#ambil").click(function(){
$.ajax({
type:"get",
url: "data.php",
@godamri
godamri / ajax-index.html
Created May 18, 2015 13:40
ajax beginner
<!DOCTYPE html>
<html>
<head>
<style>
span#buka-surat{
border:1px solid brown;
padding: 2px;
cursor:pointer;
}
</style>
<?php
$batas=7;
mysql_connect('localhost','root','');
mysql_select_db('berita');
if (isset($_GET["hal"])) { $hal = $_GET["hal"]; } else { $hal=1; };
$mulai = ($hal-1) * $batas;
$sql = "SELECT * FROM post LIMIT $mulai, $batas";
$hasil = mysql_query ($sql);
?>
<?php
function bedanya($awal,$akhir){
$bedanya = abs(strtotime($akhir) - strtotime($awal));
$tahun = floor($bedanya / (365*60*60*24));
$bulan = floor(($bedanya - $tahun * 365*60*60*24) / (30*60*60*24));
$hari = floor(($bedanya - $tahun * 365*60*60*24 - $bulan*30*60*60*24)/ (60*60*24));
return array("tahun"=>$tahun,"bulan"=> $bulan ,"hari"=> $hari);
}