This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head></head> | |
<body> | |
<button onclick="styl3('B')">bold</button> <button onclick="styl3('U')">underline</button> <button onclick="styl3('I')">italic</button> <button onclick="styl3('S')">strikethrough</button> <button onclick="hist.undo(frames['rte'].document.body)">undo</button> <button onclick="hist.redo(frames['rte'].document.body)">redo</button><br> | |
<iframe name="rte" src="about:blank" style="border:1px solid gray"></iframe> | |
<script> | |
var hist=(function(){ | |
var i=0, hist=[]; | |
return { | |
save: function(r00t){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/* implementasi readFile async menjadi promise */ | |
function readFilePromise(file, jenis){ | |
return new Promise((terima, tolak)=>{ | |
readFile(file, jenis, (salah, hasil)=>{ | |
if(salah) return tolak(salah); | |
terima(hasil); | |
}); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* https://gist.github.com/birowo/06026a6c42a9356bfac1f6b7f9915453 */ | |
/*percobaan async/await untuk mengetahui kode bagian mana yang dijalankan secara paralel & mana yang secara serial*/ | |
/*untuk lebih meyakinkan kesimpulan dari hasil percobaan di contoh ini saya pakai akses webserver / http get rekues & bukan pakai read file system karena di http get, lama proses akses bisa diatur di sisi webserver yang kita buat sendiri*/ | |
'use strict'; | |
const rute={/*rute: url(pathname) to it's handler mapping*/ | |
'/test': (rekues, respon)=>{ | |
const kueri=rekues.kueri; | |
//rekues.destroy(); | |
respon.htm(JSON.stringify(kueri)); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--percobaan generator function(sudah standard ES6), misal dipakai untuk menentukan apakah fungsi async(di contoh ini ajax) dieksekusi secara sync/serial atau async/paralel--> | |
<!--perhatikan belum semua browser support : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator ,saya coba pakai FF ver. 48 --> | |
<html> | |
<head></head> | |
<body> | |
<div><input id="respon1" readonly></div> | |
<div><input id="respon2" readonly></div> | |
<div><input id="respon3" readonly></div> | |
<div><input id="respon4" readonly></div> | |
<div><input id="respon5" readonly></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//ajaximg.php | |
if(!empty($_POST)){ | |
$imgid=uniqid('img'); | |
$img=base64_decode(str_replace(' ', '+', $_POST['imgB64'])); | |
$size=file_put_contents($imgid, $img); | |
echo "[\"$size\",\"$imgid\"]"; | |
die(); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if('localhost'==$_SERVER['HTTP_HOST']){ | |
if(empty($_GET['proxy'])){ | |
?> | |
<iframe src="javascript:" name="crossdomain" style="display:none"></iframe> | |
<form method="POST" action="http://127.0.0.1/svr.php" target="crossdomain"> | |
kata: <textarea name="kata"></textarea><br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html" /> | |
<title></title> | |
</head> | |
<body> | |
<script> | |
function respon(callback){ | |
var oldVal=''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//https://www.chriswiegman.com/2014/05/getting-correct-ip-address-php/ | |
function get_ip() { | |
//Just get the headers if we can or else use the SERVER global | |
if ( function_exists( 'apache_request_headers' ) ) { | |
$headers = apache_request_headers(); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const longpoll = []; | |
const rute = { | |
notfound: function(rekues, respon){ | |
respon.writeHead(404, {'Content-Type': 'text/html; charset=UTF-8'}); | |
respon.end('tidak ditemukan'); | |
}, | |
'/': function(rekues, respon){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const rute = { | |
notfound: function(rekues, respon){ | |
respon.writeHead(404, {'Content-Type': 'text/html; charset=UTF-8'}); | |
respon.end('tidak ditemukan'); | |
}, | |
'/': function(rekues, respon){ | |
respon.writeHead(200, {'Content-Type': 'text/html; charset=UTF-8'}); | |
respon.end(` |
OlderNewer