Skip to content

Instantly share code, notes, and snippets.

View hanafiah's full-sized avatar
🏠
Working from home

Muhamad Hanafiah Yahya hanafiah

🏠
Working from home
View GitHub Profile
@hanafiah
hanafiah / image to canvas.php
Created January 9, 2013 23:26
image to canvas
<!DOCTYPE HTML>
<html>
<body>
<?php
$img = 'http://www.saudigazette.com.sa/myfiles/Images/2012/12/18/li02.jpg';
$type = pathinfo($img, PATHINFO_EXTENSION);
$data = file_get_contents($img);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
?>
<?php
function loadimg($img)
{
//absolute path
$fullPath = '/private/'.$img;
if (is_readable($fullPath)) {
$mime = mime_content_type($fullPath);
header('Content-type: ' . $mime);
header('Content-length: ' . filesize($fullPath));
<html>
<head>
<title>Jquery Hashbang</title>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' ></script>
<script type='text/javascript'>
$(document).ready(function() {
$.ajax({
dataType: "json",
url: "https://api.scraperwiki.com/api/1.0/datastore/sqlite?format=jsondict&name=esolat&query=select%20*%20from%20%60solat%60%20limit%2010",
success: function(datas){
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar xzvf GeoIP.tar.gz
cd GeoIP*
./configure
make
make check
make install
wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.7.tar.gz
tar zxvf mod_geoip2_1.2.7.tar.gz
cd mod_geoip2_1.2.7
apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
mkdir /usr/src/geoip
mv GeoIP.dat /usr/src/geoip/
LoadModule geoip_module modules/mod_geoip.so
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/src/geoip/GeoIP.dat
</IfModule>