Skip to content

Instantly share code, notes, and snippets.

View hndr91's full-sized avatar

Afif Hendrawan hndr91

  • Malang, ID
View GitHub Profile
@hndr91
hndr91 / dbHandler.php
Last active December 9, 2015 09:48
slim mongo dbHandler
<?php
class dbHandler {
private $con;
private $col;
function __construct() {
require_once dirname(__FILE__) . '/dbConnect.php';
$db = new dbConnect();
//Connect to database
$this->con = $db->connect();
//Select "friends" collection, already defined in config.php
@hndr91
hndr91 / index.php
Last active December 9, 2015 10:12
<?php
require_once '/include/dbHandler.php';
require_once '/lib/Slim/Slim/Slim.php';
Slim\Slim::registerAutoloader();
$app = new Slim\Slim();
//Get All friends end point
$app->get('/friends', function() {
$db = new dbHandler();
$cur = $db->getAllFriends();
//Variable to store result
@hndr91
hndr91 / chart.php
Last active December 21, 2015 19:09
<?php
include 'db_con.php';
$idbarang = $_GET['id_barang']; //mendapatkan informasi id barang dari file index.php
//melakukan query pada tabel penjualan sesaui dengan informasi id barang yang didapat dari metode GET
$sql = "select * from penjualan where id_barang = '".$idbarang."' ";
$query = mysql_query($sql);
//membuat kolom pada tabel
$tabel = array();
<?php
try{
$conn = mysql_connect("localhost","root",""); //isikan sesuai dengan alamat server,username, dan password
mysql_select_db("gchart",$conn);
}
catch(Exception $e)
{
echo $e->getMessage("koneksi gagal");
}
?>
<?php
//memanggil db_con.php untuk melakukan koneksi ke database
include "db_con.php";
?>
<html>
<head>
<title>Laporan Penjualan</title>
</head>
<body>
<h1>Laporan Penjualan</h1>
@hndr91
hndr91 / genymotionwithplay.txt
Created January 6, 2016 17:11 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
@hndr91
hndr91 / index.php
Created January 28, 2016 13:03
Routing Slim
<?php
require 'vendor/autoload.php' //fitur autoload composer
//Inisiasi Slim Framewrok
$app = new \Slim\Slim();
//home routing
$app->get('/', function(){
echo "Home Base"; //print "Home Base" at http://localhost/slim
});
@hndr91
hndr91 / .htaccess
Created January 28, 2016 13:13
.htaccess Slim with RewriteBase
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
RewriteBase /slim
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
@hndr91
hndr91 / index.php
Created January 28, 2016 13:41
Index.php with View Configuration, Slim Framework
<?php
require 'vendor/autoload.php' //fitur autoload composer
//Inisiasi Slim Framewrok
$app = new \Slim\Slim(array(
'view' => new \Slim\Views\Twig(), //set template engine to Twig engine
'templates.path' => './templates' //lokasi default template bisa di ganti sesuai dengan kebutuhan
));
//home routing dengan view
$app->get('/', function() use($app){
@hndr91
hndr91 / MainActivity.java
Created March 10, 2016 14:53
WebView with upload ability
package com.webview;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.ValueCallback;