Skip to content

Instantly share code, notes, and snippets.

View skylarkcob's full-sized avatar

Cuong Dinh Lai skylarkcob

View GitHub Profile
@skylarkcob
skylarkcob / customizer-preview.js
Created April 18, 2020 08:12 — forked from danielck/customizer-preview.js
Some basic Customizer examples
/*
Include this file in your theme and enqueue it like this in PHP:
function my_customize_preview_js() {
wp_enqueue_script( 'customizer-preview', get_template_directory_uri() . '/path/to/customizer.js', array( 'customize-preview' ), '20170422', true );
}
add_action( 'customize_preview_init', 'my_customize_preview_js' );
*/
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@skylarkcob
skylarkcob / Test
Created June 25, 2014 10:12
Test stl
solid OpenSCAD_Model
facet normal -1.000000 -0.000000 -0.000000
outer loop
vertex -5.000000 -5.000000 0.000000
vertex -5.000000 -5.000000 10.000000
vertex -5.000000 5.000000 0.000000
endloop
endfacet
facet normal -1.000000 0.000000 0.000000
outer loop
@skylarkcob
skylarkcob / Lấy sản phẩm theo chuyên mục
Created June 13, 2014 14:20
Lấy sản phẩm theo chuyện mục trên blog WordPress
$args = array(
'post_type' => 'contractors',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'terms' => $taxarray,
'field' => 'id'
)
)
@skylarkcob
skylarkcob / 3D Style
Created March 31, 2014 08:35
Hướng dẫn tạo nút 3D với CSS3
ul li {
display: inline-block;
margin-right: 20px;
}
.button-container {
background:#8bcdda;
background:-moz-radial-gradient(center,ellipse cover,#a4d0d3 0,#257fa1 100%);
background:-webkit-gradient(radial,center center,0,center center,100%,color-stop(0,#a4d0d3),color-stop(100%,#257fa1));
background:-webkit-radial-gradient(center,ellipse cover,#a4d0d3 0,#257fa1 100%);
@skylarkcob
skylarkcob / 3D CSS3
Created March 31, 2014 08:30
Hướng dẫn tạo nút 3D với CSS3
<div class="button-container">
<div class="button-container-inner wrap">
<ul>
<li>
<a href="#" class="button orange">Đặt mua</a>
</li>
<li>
<a href="#" class="button light-blue">Chi tiết</a>
</li>
<li>
@skylarkcob
skylarkcob / WordPress Human Time Diff
Created March 30, 2014 10:02
Hiển thị thời gian cho WordPress theo kiểu Facebook
function sw_human_time_diff() {
global $post;
$date = get_post_time('G', true, $post);
$langs = array('giây', 'phút', 'giờ', 'ngày', 'tuần', 'tháng', 'năm');
$chunks = array(
array( 60 * 60 * 24 * 365 , __( $langs[6], 'swhtd' ), __( $langs[6], 'swhtd' ) ),
array( 60 * 60 * 24 * 30 , __( $langs[5], 'swhtd' ), __( $langs[5], 'swhtd' ) ),
array( 60 * 60 * 24 * 7, __( $langs[4], 'swhtd' ), __( $langs[4], 'swhtd' ) ),
array( 60 * 60 * 24 , __( $langs[3], 'swhtd' ), __( $langs[3], 'swhtd' ) ),
array( 60 * 60 , __( $langs[2], 'swhtd' ), __( $langs[2], 'swhtd' ) ),
@skylarkcob
skylarkcob / BFIThumb_Guide
Last active August 29, 2015 13:57
Hướng dẫn sử dụng BFIThumb để thay đổi kích thước hình ảnh.
require_once('BFI_Thumb.php');
$params = array( 'width' => 400 );
echo "<img src='" . bfi_thumb( "URL-to-image.jpg", $params ) . "'/>";
// Resize by width only
$params = array( 'width' => 400 );
bfi_thumb( "URL-to-image.jpg", $params );
@skylarkcob
skylarkcob / Login page CSS WordPress
Created December 22, 2013 10:10
CSS cho trang đăng nhập WordPress
body.login div#login h1 a {
background-image: url("../images/logo.png");
background-size: 282px 100px;
padding-bottom: 30px;
height: 80px;
width: 330px;
}
#login {
padding-top: 60px;
@skylarkcob
skylarkcob / Edit WordPress login page
Created December 22, 2013 10:08
Chỉnh sửa lại giao diện và thông báo trang đăng nhập WordPress
<?php
/**
* Plugin Name: Sau Login
* Plugin URI: http://hocwp.net
* Description: You can use this plugin to create a custom login page.
* Version: 1.2
* Author: Sau Hi
* Author URI: http://hocwp.net
* License: GNU General Public License v3.0
*/