Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* dan
* versi: asal jalan sudah..
*/
class htmlTable {
/**
foreach($_POST as $key => $value) {
$_POST[$key] = mysql_real_escape_string($value);
}
@weldan
weldan / gist:764887
Created January 4, 2011 15:18
using jQuery and MooTools in the same page
change
$(document).ready(function(){
//place codes here..
)}
to
jQuery(function($){
//place codes here..
<?php
foreach (getallheaders() as $name => $value) {
echo "$name: $value\n";
}
?>
<?php
function emu_getallheaders() {
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
$headers[$name] = $value;
} else if ($name == "CONTENT_TYPE") {
$headers["Content-Type"] = $value;
<?php
if (!function_exists('apache_request_headers')) {
function apache_request_headers() {
foreach($_SERVER as $key=>$value) {
if (substr($key,0,5)=="HTTP_") {
$key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
$out[$key]=$value;
}else{
$out[$key]=$value;
}
if (!function_exists('getallheaders'))
{
function getallheaders()
{
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
@weldan
weldan / is_readable.html
Created July 12, 2012 22:43
javascript equivalent to php is_readable
<!doctype html>
<html>
<title>is_readable?</title>
<script type="text/javascript" src="file_get_contents.js"></script>
<script type="text/javascript">
function is_readable(file) {
//http://phpjs.org/functions/file_get_contents:400
var _file = file_get_contents(file);
if (_file) {
var _length1 = _file.replace("<h1>Object not found!</h1>", "LOL", _file);
@weldan
weldan / is_readable.js
Created July 12, 2012 22:44
javascript equivalent to php is_readable
function is_readable(file) {
//http://phpjs.org/functions/file_get_contents:400
var _file = file_get_contents(file);
if (_file) {
var _length1 = _file.replace("<h1>Object not found!</h1>", "LOL", _file);
var _length2 = _file;
if (_length1.length === _length2.length) {
return true;
}
return false;
@weldan
weldan / gist:3144617
Created July 19, 2012 15:16
1 true way to work with a stupid freelancer like me
1. Value my time like you care for your money. Wealthy coder is not a coder at all. They're genius. If I am too skilled for you I don't put my title as coder, everywhere. It should be Programmer, or Rocket builder.