Skip to content

Instantly share code, notes, and snippets.

View voodooGQ's full-sized avatar

Shane Smith voodooGQ

View GitHub Profile
@voodooGQ
voodooGQ / css-vertical-align-center.css
Created June 3, 2012 16:17 — forked from mateuslopes/css-vertical-align-center.css
CSS: Vertical align center (without line-height)
.v-center, .vertical-center, .v-middle, .vertical-middle {
display: table-cell;
vertical-align: middle;
}
@voodooGQ
voodooGQ / gist:2864056
Created June 3, 2012 16:18 — forked from travist/gist:2863998
jQuery: Add jQuery Dynamically
var jQueryReady = function($) {
// Your code goes here...
console.log('jQuery Ready!');
};
// Make sure jQuery is ready.
if (typeof jQuery == 'undefined') {
var protocol = window.location.protocol;
if (protocol.charAt(protocol.length - 1) == ':') {
@voodooGQ
voodooGQ / gist:3061517
Created July 6, 2012 17:34
Javascript: Bookmark Page
<script language="javascript" type="text/javascript">
var urlAddress = window.location.pathname;
var pageName = "A-Affordable Bail Bonds, Inc.";
function addToFavorites() {
if (window.external) {
window.external.AddFavorite(urlAddress,pageName)
}
else { alert("Sorry! Your browser doesn't support this function."); }
@voodooGQ
voodooGQ / walker-nav-example.php
Created November 8, 2012 17:24 — forked from norcross/walker-nav-example.php
example of custom Walker for nav
// Menu output mods
class description_walker extends Walker_Nav_Menu
{
function start_el(&$output, $item, $depth, $args)
{
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
@voodooGQ
voodooGQ / gist:4057330
Created November 12, 2012 03:28
REGEX: Parse URL into individual parts (JavaScript: The Good Parts)
REGEX: Parse URL into individual parts (Javascript: The Good Parts)
<script type="text/javascript" language="javascript">
var parse_url = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/;
var url= "http://www.ora.com:80/goodparts?q#fragment";
var results = parse_url.exec(url);
var names = ['url', 'scheme', 'slash', 'host', 'port', 'path', 'query', 'hash'];
@voodooGQ
voodooGQ / pmo.php
Last active December 26, 2015 22:29
Post Meta Object
<?php
/**
* Returns all "public" meta items for $post in the form of an object
* Useful for reducing server calls
*
* @param int $post_id The ID of the post
* @return object
*/
function post_meta_object($post_id) {
$meta = get_post_meta($post_id);
@voodooGQ
voodooGQ / gist:7789859
Created December 4, 2013 15:49
CD to current finder window
# Place in your ~/.bash_profile
# cd to current finder window
function cdfinder()
{
cd "$(osascript -e 'tell application "Finder"' \
-e 'set myname to POSIX path of (target of window 1 as alias)' \
-e 'end tell' 2>/dev/null)"
}
@voodooGQ
voodooGQ / gist:8474406
Last active January 3, 2016 14:09
Dogge Git
alias such=git
alias very=git
alias wow='git status'
$ wow
$ such commit
$ very push
@voodooGQ
voodooGQ / getImageMeta.php
Last active August 29, 2015 14:02
getImageMeta
<?php
/**
* Returns image meta data based on the image ID supplied
*
* @param int $imageID The image post id
* @return array
*/
public static function getImageMeta($imageID)
{
@voodooGQ
voodooGQ / .rubocop.yml
Created November 20, 2017 19:49
Github Rubocop Adendum
inherit_gem:
rubocop-github:
- config/default.yml
- config/rails.yml
AllCops:
Exclude:
- 'bin/*'
- 'Gemfile'
- 'Guardfile'
DisplayCopNames: true