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 / 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;
@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 / os-stack.md
Created August 10, 2015 06:47
OS Stack
sudo npm install -g strongloop
slc loopback
slc loopback:datasource ItemsDB
> MongoDB
slc loopback:model Item
Item
>item(mongodb)
slc run
@bunnywong
bunnywong / gist:15cf311329eee201be56
Last active September 3, 2015 04:40
Android wear remark
ad uninstall com.example.android.wearablemessageapiexample
@bunnywong
bunnywong / gist:e977e7091f5e6ab54dcf
Created September 8, 2015 07:53
composer issue - ref
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The suhosin.executor.include.whitelist setting is incorrect.
Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):
suhosin.executor.include.whitelist = phar
The php.ini used by your command-line PHP is: /etc/php5/cli/php.ini
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.
@bunnywong
bunnywong / gist:fcc3906327f19708af49
Created September 12, 2015 10:31
Alert when iPhone available
var alt = $('.image-content img').attr('alt');
if (alt =="We'll be back soon") {
var rand = (Math.floor(Math.random() * 200) + 1 ) / 100; // 0.01 to 2 sec
console.log("We'll be back soon :D ");
console.log('random refresh in ' + rand + 'sec');
setTimeout(redirect(), rand);
} else {
alert('PAGE AVAILABLE !!!');
}
wget -r --user='[email protected]' --password='mypwd' ftp.example.com
@bunnywong
bunnywong / Vagrant
Last active October 20, 2015 11:41
Vagrant example
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "My Vagrant"
# config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
@bunnywong
bunnywong / .htaccess
Created December 6, 2015 07:07
Example of sub folder as root URL at Wordpress - lowb.me
# 1. This .htaccess located in root level
# 2. Wordpress source in '{root}/lowb.me/public'
# 3. Add below in wp-config.php
# define('WP_HOME','http://lowb.me/lowb.me/public');
# define('WP_SITEURL','http://lowb.me');
# Ref:
# http://marktyrrell.com/2012/09/installing-wordpress-in-a-subdirectory-running-it-from-the-root-directory/
# Turn on rewrites.