Skip to content

Instantly share code, notes, and snippets.

View ianthekid's full-sized avatar

Ian Ray ianthekid

View GitHub Profile
<div id='woobox-root'></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//woobox.com/js/plugins/woo.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'woobox-sdk'));</script>
@ianthekid
ianthekid / gist:7b4d3fbf0e3ea74378ec
Created October 16, 2014 15:13
mysql export and import via ssh
/*
* Export database
*/
mysqldump -u $username -p -h $host $database > database_backup.sql
/*
* Import database
@ianthekid
ianthekid / gist:f070fb8374d117b3ff39
Created October 16, 2014 15:17
Create multi-part tar archives of large directory
/*
* Create multi-part archive of ./www/
*/
tar czf - www|split -b 1073741824 - www_backup.tar.
/*
* Extract multi-part archive
/*
* Cron job: Backup database
* Works with cPanel Cron Scheduler
*/
mysqldump -u $user -p$password -h $dbhost $database > /path/to/db_bak_`date +\%Y\%m\%d`.sql
@ianthekid
ianthekid / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ianthekid
ianthekid / gist:17eee00d0d19045e31a7
Created February 15, 2015 19:08
Wordpress update database for staging
/*
* Wordpress Staging/Development
*/
UPDATE wp_options SET option_value = REPLACE(option_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET guid = REPLACE(guid, 'ORIGINAL_URL', 'NEW_URL');
@ianthekid
ianthekid / gist:b1d17a6208589dd1d421
Created February 25, 2015 06:18
Delete orphan wp_postmeta rows
SELECT *
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
@ianthekid
ianthekid / gist:2b3bb2ad751a3558739f
Created February 25, 2015 06:19
Repair Permissions CentOS / Apache
find . -type d -exec chmod 755 {} + ; find . -type f -exec chmod 644 {} +
@ianthekid
ianthekid / ios_bg.css
Last active August 29, 2015 14:18
Fix Background Size cover for iOS Safari stretching max 100%
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
.bg {
background-attachment: scroll !important;
}
}
@ianthekid
ianthekid / gist:ea34cc4fd8b908733192
Created June 29, 2015 17:37
git fetch and rebase
git fetch
git rebase origin/master
#Source: http://stackoverflow.com/questions/7200614/how-to-merge-remote-master-to-local-branch
#git merge branchname takes new commits from the branch branchname, and adds them to the current branch. If necessary, it automatically adds a "Merge" commit on top.
#git rebase branchname takes new commits from the branch branchname, and inserts them "under" your changes. More precisely, it modifies the history of the current branch such that it is based on the tip of branchname, with any changes you made on top of that.