Skip to content

Instantly share code, notes, and snippets.

View namncn's full-sized avatar

Nam NCN namncn

View GitHub Profile
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
4 0 E > ECHO 'Yay%0A'
7 1 > RETURN 1
@namncn
namncn / how
Created January 18, 2017 11:12
def multiply_by_two (n)
n * 2
@namncn
namncn / ex
Created January 18, 2017 11:13
> IRB
2.2.0: 001> require './math'
=> Đúng
2.2.0: 002> multiply_by_two 2
=> 4
2.2.0: 003> multiply_by_two -2
=> -4
@namncn
namncn / ex
Created January 18, 2017 11:14
2.2.0: 004> multiply_by_two
ArgumentError: sai số của đối số (0 trong 1)
from /Users/bill/dev/math.rb:1:in 'multiply_by_two'
from (IRB): 4 từ /Users/bill/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `main'
2.2.0: 005> multiply_by_two "ruby"
=> "Rubyruby"
2.2.0: 006> multiply_by_two nil
NoMethodError: Phương pháp xác định `* 'cho con số không: NilClass
from /Users/bill/dev/math.rb:2:in 'multiply_by_two'
from (IRB): 6
@namncn
namncn / ex
Created January 18, 2017 11:15
def multiply_by_two (n = "không có giá trị cung cấp")
if (n.is_a? (Integer))
n * 2
khác
nâng ArgumentError.new ( "Xin vui lòng cung cấp một số hợp lệ")
@namncn
namncn / ex
Created January 18, 2017 11:16
> IRB
2.2.0: 001> require './math'
=> Đúng
2.2.0: 002> multiply_by_two 2
=> 4
2.2.0: 003> multiply_by_two -2
=> -4
2.2.0: 004> multiply_by_two
ArgumentError: Xin cung cấp một số hợp lệ
from /Users/bill/dev/math.rb:3:in 'multiply_by_two'
<div class="ncn_form-control">[text* your-name placeholder "Họ và Tên"]</div>
<div class="ncn_form-control">[email* your-email placeholder "Email của bạn"]</div>
<div class="ncn_form-control">[tel your-phone placeholder "Số điện thoại"]</div>
<div class="ncn_form-control">[textarea your-message placeholder "Điền nội dung bạn muốn gửi..."]</div>
<div class="ncn_form-submit">[submit "Gửi đi"]</div>
@namncn
namncn / elementor-control.php
Created July 10, 2018 02:56
Tổng hợp các control của Elementor
<?php
/**
* TEXT control.
*/
$this->add_control(
'title',
[
'label' => __( 'Title', 'elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
<?php
/**
* Remove custom post type slug from URL.
*/
function pdvn_remove_slug( $post_link, $post, $leavename ) {
if ( 'product' != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}
.woocommerce .col2-set .col-1, .woocommerce-page .col2-set .col-1, .woocommerce .col2-set .col-2, .woocommerce-page .col2-set .col-2 {
flex: 0 0 100%;
max-width: 100%;
}
/* Woocommerce Styles */
/*
A couple things to note...
1. This code was written very specifically for my base child theme so it might not work out of the box with every theme.