Skip to content

Instantly share code, notes, and snippets.

Avatar

Drew Douglass DrewDouglass

View GitHub Profile
@DrewDouglass
DrewDouglass / smoothscroll.js
Created Nov 2, 2015
Smooth Scrolling for #links
View smoothscroll.js
//Smooth scrolling for #links
var $root = $('html, body');
$('a').click(function() {
var href = $.attr(this, 'href');
$root.animate({
scrollTop: $(href).offset().top
}, 1000, function () {
window.location.hash = href;
});
return false;
View Enable HDMI audio for Raspberry Pi
sudo nano /boot/config.txt
#edit or add hdmi_drive to hdmi_drive=2
@DrewDouglass
DrewDouglass / wordpresslatest.sh
Created Dec 10, 2015
Grab latest WP version, extract, and copy to document root. Gist sent from Command line
View wordpresslatest.sh
wget http://wordpress.org/latest.tar.gz && tar -xzvf latest.tar.gz && cp -r wordpress/* . && rm -rf wordpress
@DrewDouglass
DrewDouglass / a.rb
Created Dec 11, 2015
Bootstrap animated hamburger toggle.
View a.rb
.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 / bootstrap-custom-menu-breakpoint.css
Last active Dec 16, 2015
Snippet to change breakpoint of hamburger menu without needing to recompile SASS. Tested in bootstrap 3.
View bootstrap-custom-menu-breakpoint.css
@media (max-width: !!!YOUR BREAKPOINT!!!) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
@DrewDouglass
DrewDouglass / addkeys.sh
Created Dec 21, 2015
Add existing keys to remote server
View addkeys.sh
cat ~/.ssh/id_rsa.pub | ssh root@example.com 'cat - >> ~/.ssh/authorized_keys'
@DrewDouglass
DrewDouglass / bootstrap-menu-hover.css
Created May 3, 2016
Show bootstrap dropdown menus on hover instead of click.
View bootstrap-menu-hover.css
/***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 / steps.txt
Created May 20, 2016
Cleaning a hacked WordPress website.
View steps.txt
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 / flicker-images.js
Last active Jun 9, 2016
Hide/show list of images with jQuery
View flicker-images.js
//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 / Meta Responsive Tag
Created Jul 21, 2016
Because I always forget the syntax.
View Meta Responsive Tag
<meta name="viewport" content="width=device-width, initial-scale=1">
You can’t perform that action at this time.