Skip to content

Instantly share code, notes, and snippets.

Matt Banks mattbanks

Block or report user

Report or block mattbanks

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mattbanks / js-detectie
Created May 4, 2012 — forked from padolsey/gist:527683
JavaScript: Detect IE
View js-detectie
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
mattbanks / gist:2956247
Created Jun 19, 2012
Animate Scroll to Top
View gist:2956247
// Animate scroll to top
$('.top').on('click', function() {
scrollTop: 0
}, 600);
return false;
mattbanks / gist:2979288
Created Jun 23, 2012
WordPress as git submodule
View gist:2979288
cd wpstarter
git init
git submodule add git:// wp
cd wp
git fetch --tags
git checkout 3.4
cd ..
git add .
git commit -m 'core files, checkout 3.4'
mattbanks / gist:3004901
Created Jun 27, 2012 — forked from jchristopher/gist:2998780
AppleScript: iTerm tail PHP error log
View gist:3004901
tell application "iTerm"
set t to (make new terminal)
tell t
tell (make new session at the end of sessions)
exec command "tail -f /Applications/MAMP/logs/php_error.log"
end tell
end tell
end tell
mattbanks / gist:3153899
Created Jul 20, 2012
Create new WP_Query with TextExpander (version 4 required)
View gist:3153899
// New query
$%filltext:name=Query Name:default=myquery%_args = array(
'post_type' => '%filltext:name=Post Type:default=post%',
'order' => '%fillpopup:name=popup 7:default=ASC:DESC%',
'orderby' => '%fillpopup:name=popup 9:default=date:ID:rand:title:author:menu_order%',
'post_status' => 'publish',
'posts_per_page' => %filltext:name=Posts Per Page:default=-1%
$%filltext:name=Query Name:default=myquery% = new WP_Query( $%filltext:name=Query Name:default=myquery%_args );
mattbanks / gist:3379965
Created Aug 17, 2012 — forked from billerickson/gist:3379905
WordPress Security
View gist:3379965
WordPress is actually one of the most secure pieces of software available. It powers 17%
of the 1,000,000 most visited websites, so it is being constantly tested both internally
and by hackers. When an issue is discovered, an update is released which you can install
with one click in the dashboard.
The vast majority of hacked WordPress websites are running an out-of-date version of
WordPress. Once WordPress is updated, any vulnerabilities that are patched are now publicly
known, so old versions are vulnerable.
The next most likely source of hacking is your host. If your server isn't secure, it doesn't
mattbanks / Key Bindings - User
Created Aug 23, 2012
Sublime Text 2 Settings
View Key Bindings - User
{ "keys": ["super+alt+7"], "command": "encode_html_entities" },
{ "keys": ["shift+ctrl+u"], "command": "title_case" },
{ "keys": ["super+enter"], "command": "insert", "args": {"characters": "<br>\n"} },
{ "keys": ["super+alt+l"], "command": "insert_snippet", "args": {"contents": "<li>${0:$SELECTION}</li>" } },
{ "keys": ["super+alt+b"], "command": "insert_snippet", "args": {"contents": "<strong>${0:$SELECTION}</strong>" } },
{ "keys": ["super+alt+i"], "command": "insert_snippet", "args": {"contents": "<em>${0:$SELECTION}</em>" } },
{ "keys": ["super+alt+n"], "command": "insert_snippet", "args": {"contents": "<span>${0:$SELECTION}</span>" } },
{ "keys": ["super+alt+down"], "command": "insert_snippet", "args": {"contents": "<sub>${0:$SELECTION}</sub>" } },
mattbanks /
Created Aug 23, 2012 — forked from oodavid/
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
    • apache's home directory is /var/www/
mattbanks / gist:3487914
Created Aug 27, 2012 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts
View gist:3487914

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
mattbanks / gist:4741474
Created Feb 8, 2013
Pods 2.3a7 post_content filters
View gist:4741474
function mb_show_testimonial() {
global $post;
$portfolio = pods( 'portfolio', $post->ID );
<div class="testimonial">
<?php echo $portfolio->display( 'testimonial' ); ?>
<p class="author"><?php echo $portfolio->display( 'testimonial_author' ); ?></p>
You can’t perform that action at this time.