Skip to content

Instantly share code, notes, and snippets.

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

Hung PD thehung2224

🏠
Working from home
View GitHub Profile
@thehung2224
thehung2224 / gist:8414537
Created January 14, 2014 07:33
HTML: Standard Template
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title> </title>
<meta name="description" content="">
<meta name="author" content="">
@thehung2224
thehung2224 / gist:8423555
Created January 14, 2014 18:48
Lorem: Very short text
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
@thehung2224
thehung2224 / gist:8429919
Created January 15, 2014 02:48
CSS: Reset
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
@thehung2224
thehung2224 / gist:8430660
Created January 15, 2014 04:17
LESS: Mixins
.round(@radius: 5px){
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
@thehung2224
thehung2224 / gist:c50e695b458d64104f62
Last active August 29, 2015 14:17
Cách dùng Preg_match trong PHP
if ( !function_exists( 'extract_gallery_images_ids' ) ) {
function extract_gallery_images_ids() {
global $post;
$content = "[gallery ids="7,8,9,10"]";
$pattern = "\[(\[?)(embed|wp_caption|caption|playlist|audio|video|dot_recommends|dot_recommended_posts|gallery)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)"
preg_match( "/$pattern/s", $content, $match );
@thehung2224
thehung2224 / Share Pinterest
Created May 25, 2017 04:05 — forked from cdharrison/pinterest
Set Default Pinterest Share Image based on Featured Image
<?php if ( has_post_thumbnail() ) :
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 720,405 ), false, '' );
?>
<a href="http://pinterest.com/pin/create/button/?media=<?php echo $src[0]; ?>&url=<?php the_permalink() ?>" class="pin-it-button" count-layout="none"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
<?php else : ?>
<a href="http://pinterest.com/pin/create/button/?media=http://example.com/example.png&url=<?php the_permalink() ?>" class="pin-it-button" count-layout="none"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
<?php endif; ?>