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
sudo apt-get install php5-fpm

Vagrant init

vagrant box add hashicorp/precise32
vagrant init sixlive/tjay-ubuntu-12-php-53

Apache

cd /etc/apache2/sites-available/
sudo a2ensite example.com.conf
- Apache
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
sudo chown -R $USER:$USER /var/www/lunch-together.xxx/public
sudo chmod -R 755 /var/www
sudo a2ensite lunch-together.xxx
- MySQL
@bunnywong
bunnywong / gist:f55188114f75c17e54b1
Last active August 29, 2015 14:19
Ubuntu Commond
# Apache
sudo chown -R $USER:$USER /var/www/lunch-together.xxx/public_html
sudo chmod -R 755 /var/www
a2ensite lunch-together.xxx
a2dissite lunch-together.xxx
service apache2 reload
service apache2 restart
@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
$ 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: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
@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
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: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