Skip to content

Instantly share code, notes, and snippets.

View sutandang's full-sized avatar

eringga sutandang

  • indonesia
  • yogyakarta , indonesia
View GitHub Profile
/*************************
* Enqueue Media Uploader
*************************/
function enqueue_admin_scripts() {
if(function_exists('wp_enqueue_media')) {
wp_enqueue_media();
}
else {
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
<?php
// Skip the cart and redirect to check out url when clicking on Add to cart
add_filter ( 'add_to_cart_redirect', 'redirect_to_checkout' );
function redirect_to_checkout() {
global $woocommerce;
// Remove the default `Added to cart` message
wc_clear_notices();
return $woocommerce->cart->get_checkout_url();
@sutandang
sutandang / getdistance.php
Last active August 29, 2015 14:23
get distance from many locations with google maps api v3
/*
$locations = array('longitude,latitude')
*/
function getDistance($locations)
{
$waypoints = $locations;
if(count($waypoints) > 2)
{
unset($waypoints[0]);
unset($waypoints[count($locations) - 1]);
<?php
/**
* This is a very basic getting started example for setting up a basic project using PSR-4 and
* using composer's autoloader to run the tests.
*
*/
// Create directory MyApp
// Inside MyApp/ create composer.json with the below contents
@sutandang
sutandang / tonjooblog-ssl.conf
Created January 21, 2015 03:26
vhost ssl(https) and vhost http
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin [email protected]
ServerName tonjooblog.dev
ServerAlias www.tonjooblog.dev
DocumentRoot /var/www/tonjooblog
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular