Skip to content

Instantly share code, notes, and snippets.

View bunnywong's full-sized avatar
🙃
code for food

BunnY bunnywong

🙃
code for food
View GitHub Profile
@bunnywong
bunnywong / Embed youtube CSS in Drupal
Last active August 29, 2015 14:11
Embed youtube CSS in Drupal
.field-item {
position: relative;
padding-bottom: 56.25%; /* - 16:9 aspect ratio (most common) */
/* padding-bottom: 62.5%; - 16:10 aspect ratio */
/* padding-bottom: 75%; - 4:3 aspect ratio */
padding-top: 30px;
height: 0;
overflow: hidden;
}
@bunnywong
bunnywong / gist:f1600573ad4afbfa1d5d
Last active August 29, 2015 14:15
My Sublime quick key (Default)
----- SELECT -----
Ctrl Shfit + A = Select inner <tag>
----- ADD -----
Alt Shfit + W = Create new <tag>
----- REMOVE -----
Ctrl Shfit + K = Remove tail <tag>
Ctrl K , Ctrl + backspace = Del to head
Ctrl K, Ctrl K, = Del to end
@bunnywong
bunnywong / gist:6fc72139a5adb7d3f8f9
Created March 12, 2015 15:50
Query offer products
SELECT *, (quantity * price - reward) AS rewardDiff
FROM `oc_order_product`
WHERE `name` LIKE '%以上%'
AND (quantity * price - reward) < 0
ORDER BY rewardDiff
@bunnywong
bunnywong / gist:516e9a6d01c82e331d43
Created March 12, 2015 15:52
Opencart - Fix reward as product price
UPDATE oc_order_product SET reward = total
WHERE name LIKE '%以上%'
AND (quantity * price - reward) < 0
@bunnywong
bunnywong / gist:36bc0f1dc2cbcdcddb05
Last active August 29, 2015 14:16
Opencart - Status
# Query penning status(1)
SELECT * FROM `oc_order`
WHERE (`order_id` BETWEEN 100 AND 200)
AND `order_status_id` = 1
ORDER BY `order_status_id`
# Update: penning status(1) ONLY
UPDATE oc_order SET order_status_id = 5
WHERE (`order_id` BETWEEN 100 AND 200)
AND `order_status_id` = 1
SELECT op.product_id, op.name, op.quantity, op.reward
FROM oc_order_product op, oc_product_reward pr, `oc_order` o
WHERE op.product_id = pr.product_id
AND o.customer_group_id = pr.customer_group_id
AND o.order_id = op.order_id
AND o.order_id = '1415'
AND points > 0
AND o.customer_id > 0
@bunnywong
bunnywong / gist:c36ff7e04f45960d1d89
Created March 21, 2015 19:21
Opencart - Less reward by coupon used
DS15030247
Coupon value: $12.7
Total price(exclude shipping): $127
Sys reward: 89 + 16 = 105 (less )
Collect reward: $127 - $12.7 = 114.3
Products qty:
10 + 1pcs
(RA)reward adjustment of coupon
$12.7 / 11 = 1.15
@bunnywong
bunnywong / gist:0629699afe50d4623549
Last active August 29, 2015 14:18
Laravel - Note
// PHP Composer
$ composer.phar self-update
$ composer.phar update --dev
$ vendor/bin/phpunit -c app/
// MYSQL
$ mysql -uroot -p
mysql> show variables like '%sock%';
/tmp/mysql.sock #Answer
$ php artisan migrate:refresh --seed
# nstead of issuing
$ php artisan migrate:reset
$ php artisan migrate
artisan env
--------------------------------------------------
// After remove migrate file
composer dump-autoload
@bunnywong
bunnywong / gist:a158b1b1f5060627ddbd
Last active August 29, 2015 14:19
Lunch together calc
#Detail
SELECT username,(cost) FROM posts, users
WHERE
consumer_id = 2 &&
posts.payer_id = users.id &&
payer_id <> 2
#Summary
SELECT username,SUM(cost) FROM posts, users
WHERE