Skip to content

Instantly share code, notes, and snippets.

View DrewDouglass's full-sized avatar
🤠

Drew Douglass DrewDouglass

🤠
View GitHub Profile
@DrewDouglass
DrewDouglass / batchbw.sh
Created August 3, 2016 17:17
Batch convert JPGs to grayscale with ImageMagick
mkdir bw && for i in *.jpg; do convert $i -colorspace Gray bw/$i; done
@DrewDouglass
DrewDouglass / replacespace.bash
Created July 29, 2016 18:23
Bash script to replace spaces in filename with underscore.
for f in *\ *; do mv "$f" "${f// /_}"; done
@DrewDouglass
DrewDouglass / Meta Responsive Tag
Created July 21, 2016 20:31
Because I always forget the syntax.
<meta name="viewport" content="width=device-width, initial-scale=1">
@DrewDouglass
DrewDouglass / flicker-images.js
Last active June 9, 2016 18:45
Hide/show list of images with jQuery
//http://snook.ca/archives/javascript/simplest-jquery-slideshow
(function($){
$.fn.simplestSlideShow = function(settings){
var config = {
'timeOut': 3000,
'speed': 'normal'
};
if (settings) $.extend(config, settings);
this.each(function(){
var $elem = $(this);
@DrewDouglass
DrewDouglass / steps.txt
Created May 20, 2016 21:06
Cleaning a hacked WordPress website.
Cleaning a (typical) Hacked Site
- Create backup of site
- Deactivate any unnecessary plugins. Delete any plugins and themes that are not in use.
- Update all plugins and WordPress through WP admin. We'll replace everything later, but this allows any database updates to happen.
- Download wordpress.org/latest.zip.
- Download fresh copies of every plugin.
- If ACF 4.x installed, upload ACF 5.x and go through database updates (if multi-site, have to go through each site as of now). Then delete ACF 4.x and add-on plugins.
- Review wp-config.php to make sure there is no malicious code. If not confident, install fresh copy of wp-config.php with correct database information.
- Deactivate site by commenting out database info in wp-config.php
- Delete all files and folders in root directory except wp-config.php and wp-content/, and possibly any non-WP folders such as emails.
@DrewDouglass
DrewDouglass / bootstrap-menu-hover.css
Created May 3, 2016 16:16
Show bootstrap dropdown menus on hover instead of click.
/***ADD THE JAVASCRIPT BELOW IF MAIN DROPDOWN ITEM TO BE CLICKABLE***/
/***http://stackoverflow.com/questions/8878033/how-to-make-twitter-bootstrap-menu-dropdown-on-hover-rather-than-click***/
.sidebar-nav {
padding: 9px 0;
}
.dropdown-menu .sub-menu {
left: 100%;
position: absolute;
top: 0;
@DrewDouglass
DrewDouglass / addkeys.sh
Created December 21, 2015 19:39
Add existing keys to remote server
cat ~/.ssh/id_rsa.pub | ssh root@example.com 'cat - >> ~/.ssh/authorized_keys'
@DrewDouglass
DrewDouglass / bootstrap-custom-menu-breakpoint.css
Last active December 16, 2015 21:43
Snippet to change breakpoint of hamburger menu without needing to recompile SASS. Tested in bootstrap 3.
@media (max-width: !!!YOUR BREAKPOINT!!!) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
@DrewDouglass
DrewDouglass / a.rb
Created December 11, 2015 21:34
Bootstrap animated hamburger toggle.
.navbar-toggle .icon-bar:nth-of-type(2) {
top: 1px;
}
.navbar-toggle .icon-bar:nth-of-type(3) {
top: 2px;
}
.navbar-toggle .icon-bar {
position: relative;
@DrewDouglass
DrewDouglass / wordpresslatest.sh
Created December 10, 2015 03:18
Grab latest WP version, extract, and copy to document root. Gist sent from Command line
wget http://wordpress.org/latest.tar.gz && tar -xzvf latest.tar.gz && cp -r wordpress/* . && rm -rf wordpress