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 npm install -g strongloop
slc loopback
slc loopback:datasource ItemsDB
> MongoDB
slc loopback:model Item
Item
>item(mongodb)
slc run
@bunnywong
bunnywong / os-stack.md
Created August 10, 2015 06:47
OS Stack
@bunnywong
bunnywong / sql
Created August 9, 2015 13:28
WP Migrate
SET @OLD = '//old-site.com';
SET @NEW = '//new-site.com';
UPDATE wp_posts SET guid = REPLACE(guid, '@OLD', '@NEW');
UPDATE wp_posts SET post_content = REPLACE(post_content, '@OLD', '@NEW');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, '@OLD', '@NEW');
UPDATE wp_options SET option_value = REPLACE(option_value, '@OLD', '@NEW') WHERE option_name = 'home' OR option_name = 'siteurl';
@bunnywong
bunnywong / gist:9b9d85039e00810455f5
Last active August 29, 2015 14:26
MySQL Color & Permission
Installed color MySQL
https://github.com/nitso/colour-mysql-console
Access from host
> ip add
mysql> mysql -u root;
mysql> grant all on prefix.* to [email protected];
mysql> flush privileges;
Function
- check_plain() // Return pure text(html)
drush cc all
# Dump
drush sql-dump >dump.sql
drush sql-dump --gzip > ./sql/ime.sql.gz
# Login
drush uliSQL
@bunnywong
bunnywong / gist:ed27baeaab308914a4e7
Last active August 29, 2015 14:24
TODO: Fix unique address not as default
SELECT
oc_customer.email AS 'email',
oc_customer.customer_id AS 'customer_cid',
oc_customer.address_id AS 'customer_addressId',
oc_address.customer_id AS 'address_cid',
oc_address.address_id AS 'address_addressId',
COUNT(oc_address.customer_id) as 'address_count'
FROM
oc_customer, oc_address
@bunnywong
bunnywong / gist:8cff633f9f97546c6fe1
Created July 10, 2015 09:52
Drupal Common Module
Token
Views
Devel
nano ~/.bashrc
@bunnywong
bunnywong / gist:ed1ab5139fe17a5f213a
Created July 9, 2015 15:10
Wordpress MySQL migration code
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.old-domain.com', 'http://www.new-domain.com');
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';