Skip to content

Instantly share code, notes, and snippets.

View onnayokheng's full-sized avatar

Onnay Okheng onnayokheng

View GitHub Profile
((d, s, id) ->
js = undefined
fjs = d.getElementsByTagName(s)[0]
return if d.getElementById(id)
js = d.createElement(s)
js.id = id
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"
fjs.parentNode.insertBefore js, fjs
) document, "script", "facebook-jssdk"

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
var departure = new google.maps.LatLng(-6.18049, 106.82638); //Set to whatever lat/lng you need for your departure location
var arrival = new google.maps.LatLng(-6.17770, 106.82141); //Set to whatever lat/lng you need for your arrival location
var line = new google.maps.Polyline({
path: [departure, departure],
strokeColor: "#FF0000",
strokeOpacity: 0.7,
strokeWeight: 2,
geodesic: true, //set to false if you want straight line instead of arc
map: map,
});
@onnayokheng
onnayokheng / Amazing of WooCommerce
Last active August 29, 2015 14:01
Amazing of WooCommerce
Main Link --> http://www.woothemes.com/woocommerce/
See the video, it's great!
**See WooCommerce from Usability**
-------------------------------
- Discount
- Unlimited Coupon Code (http://take.ms/5wfoh)
- Variation Products (http://take.ms/SfGy6)
- SKU
- Price and Sale Price (http://take.ms/krx26)
@onnayokheng
onnayokheng / get-thumbnail-youtube
Last active August 29, 2015 14:06
get youtube thumbnail from content
<?php
/* Get thumbnail from Video Embed code */
function nesia_get_video_image() {
global $post;
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $post->post_content, $match)) {
$video_id = $match[1];
} else {
return false;
}
require "formula"
class Mongodb < Formula
homepage "http://www.mongodb.org/"
url "http://downloads.mongodb.org/src/mongodb-src-r2.6.5.tar.gz"
sha1 "f5a68505a0de1152b534d62a8f0147d258d503a0"
bottle do
sha1 "d573717ca7c67455680a6823de210c940faf9ac6" => :mavericks
sha1 "f7d2a0711e3ac09fd61bcb243360c1a07fb83233" => :mountain_lion
@onnayokheng
onnayokheng / coundown-evergreen.php
Created March 15, 2017 06:47
replace file ini
<?php
namespace ElementorLandingPress\Widgets;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Typography;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
use Elementor\Utils;
use Elementor\Widget_Base;
!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=134)}([function(e,t,n){(function(e){!function(t,n){e.exports=n()}(0,function(){"use strict";function t(){return Ma.apply(null,arguments)}function a(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function i(e){var t;for(t in e)return!1;return!0}function o(e){return void 0===e}function s(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function l(e){return e instanceof Date||"[object Dat
@onnayokheng
onnayokheng / query-inventory-multiple-tables.sql
Created March 18, 2018 02:36
Query for calculate inventory item from multiple tables
SELECT
inventories.product_id,
products.name as product_name,
stock_create.stock_production as total_stock_production,
SUM(inventories.qty) as total_stock_in,
SUM(distribusi.stock) as total_stock_in_warehouse,
SUM(inventories.qty - delivery.stock) as total_stock_current,
delivery.stock as total_stock_out
FROM inventories
LEFT JOIN (
@onnayokheng
onnayokheng / functions.php
Last active July 13, 2018 15:28
Add countdown on thankyou page
<?php
/**
* Add countdown into view order and thankyou page
* @author: Onnay Okheng (@onnayokheng)
*/
add_action( 'woocommerce_thankyou', 'matamerah_add_countdown_checkout' );
add_action( 'woocommerce_view_order', 'matamerah_add_countdown_checkout' );
function matamerah_add_countdown_checkout($order_id = 0)
{