Skip to content

Instantly share code, notes, and snippets.

View nguyenvanduocit's full-sized avatar
🌴
On vacation

Duoc Nguyen nguyenvanduocit

🌴
On vacation
View GitHub Profile
@nguyenvanduocit
nguyenvanduocit / MusicPlayer_AudioPlayer.vue
Created September 6, 2019 03:46
SoundWave and AudioPlayer Animation
<template>
<audio
ref="audio"
src="/audio/magical.mp3"
preload="auto"
loop
@canplaythrough="audioLoaded"
>
<p>If you are reading this, it is because your browser does not support the audio element.</p>
</audio>
@nguyenvanduocit
nguyenvanduocit / docker-compose.yaml
Created July 11, 2019 01:46
Docker compose file for owncloud
version: '2.1'
volumes:
files:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/Users/duocnguyen/Tmp/owncloud-docker-server/files'
mysql:
@nguyenvanduocit
nguyenvanduocit / mixins.styl
Created April 7, 2018 09:03
Stylus Mixins
// Rem output with px fallback
font-size($sizeValue = 16)
font-size $sizeValue * 1px
font-size (($sizeValue / 16) * 1)rem
// Center block
center-block()
display block
margin-left auto
margin-right auto
@nguyenvanduocit
nguyenvanduocit / index.html
Last active January 14, 2016 16:24
Css tech to horizontal align text div with word wrapable
<div class="sidebar-top-author">
<img class="author-avatar" src="images/avatar.png" alt="">
<div class="author-name">
<div class="author-name-inner">
<span class="author-name-text">Duoc Nguyen</span>
</div>
</div>
</div>
@5iDS
5iDS / wpdb-transactions
Created June 30, 2013 22:37
MySQL database transaction, using the WordPress database object $wpdb. When you render a page in WordPress (front end or admin area), the $wpdb database object has already been initialised and opened up a connection to the database. Therefore we can recycle this database connection for our own needs. The $wpdb object saves the database handle as…
<?php
global $wpdb;
// @ prefix used to suppress errors, but you should do your own
// error checking by checking return values from each mysql_query()
// Start Transaction
@mysql_query("BEGIN", $wpdb->dbh);
// Do some expensive/related queries here
@nguyenvanduocit
nguyenvanduocit / wordpress.single_term_slug.php
Created June 8, 2013 19:43
Lấy slug của một term,
function single_term_slug( $prefix = '', $display = true ) {
$term = get_queried_object();
if ( !$term )
return;
if ( is_category() )
$term_slug = apply_filters( 'single_cat_slug', $term->slug );
elseif ( is_tag() )
$term_slug = apply_filters( 'single_tag_slug', $term->slug );
elseif ( is_tax() )
$term_slug = apply_filters( 'single_term_slug', $term->slug );
@dfreerksen
dfreerksen / Curl.php
Created August 17, 2012 16:19
PHP Curl helper class (PHP 5.2+)
<?php
class Curl {
/**
* cURL request method
*
* @var string
*/
protected $_method = 'GET';