Skip to content

Instantly share code, notes, and snippets.

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

Thanh Nguyen Dac thanh4890

🏠
Working from home
View GitHub Profile

NTC

  • Mô tả qua life cycle React
  • Tại sao phải dùng Redux? Giải thích và thuyết phục cho 1 người mới?
  • Sẽ in ra thế nào?
    console.log(1)
    for (var i = 1; i < 4; i++) {
      console.log(i)
    }
    

console.log(10)

@thanh4890
thanh4890 / config.rb
Created November 29, 2016 10:20 — forked from nathansmith/config.rb
Example config.rb file for Compass
preferred_syntax = :sass
http_path = '/'
css_dir = 'assets/stylesheets'
sass_dir = 'assets/sass'
images_dir = 'assets/images'
javascripts_dir = 'assets/javascripts'
relative_assets = true
line_comments = true
# output_style = :compressed
@thanh4890
thanh4890 / wc-empty-cart-notice.php
Created November 20, 2016 13:59 — forked from bekarice/wc-empty-cart-notice.php
WooCommerce: Show a notice throughout the store if the cart is empty
/**
* Tutorial: http://www.skyverge.com/blog/check-if-woocommerce-cart-is-empty/
**/
function skyverge_empty_cart_notice() {
if ( WC()->cart->get_cart_contents_count() == 0 ) {
wc_print_notice( __( 'Get free shipping if your order is over &#36;60!', 'woocommerce' ), 'notice' );
// Change notice text as desired
}
@thanh4890
thanh4890 / gulpfile.js
Created April 6, 2016 01:10 — forked from mlouro/gulpfile.js
gulpfile.js with browserify, jshint, libsass, browserSync for livereload, image optimization and system notifications on errors
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require('del');
var uglify = require('gulp-uglify');
var gulpif = require('gulp-if');
var exec = require('child_process').exec;
var notify = require('gulp-notify');

Replace:

query_posts( 'post_type=post&paged=' . get_query_var( 'paged' ) );

by

if ( ! is_category() ) { query_posts( 'post_type=post&amp;paged=' . get_query_var( 'paged' ) ); }

@thanh4890
thanh4890 / .htaccess
Last active September 23, 2015 03:57
CodeIgniter remove index.php
v1 in root:
RewriteEngine on
RewriteBase /ci
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
v2 in public/:
<IfModule mod_rewrite.c>
PHP Framework
laravel
zend
yii
code igniter
Caching
memcached
redis
@thanh4890
thanh4890 / medium-size
Created April 29, 2015 06:16
Crop thumbnail to exact dimensions on Wordpress for medium size
if(false === get_option("medium_crop")) {
add_option("medium_crop", "1");
} else {
update_option("medium_crop", "1");
}
<?php $kopa_setting = kopa_get_template_setting();
$layout_id = $kopa_setting['layout_id'];
?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( has_post_thumbnail() && get_post_format() == '' ) :
$thumbnail_id = get_post_thumbnail_id();
$thumbnail = wp_get_attachment_image_src( $thumbnail_id, 'kopa-image-size-0' );
?>
<div class="entry-thumb">
<img src="<?php echo $thumbnail[0]; ?>" alt="<?php the_title(); ?>">