Skip to content

Instantly share code, notes, and snippets.

View bgallagh3r's full-sized avatar

Brian Gallagher bgallagh3r

View GitHub Profile
# SSH Agent Functions
# Mark Embling (http://www.markembling.info/)
#
# How to use:
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice)
# - Import into your profile.ps1:
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes]
# - Enjoy
#
# Note: ensure you have ssh and ssh-agent available on your path, from Git's Unix tools or Cygwin.
@bgallagh3r
bgallagh3r / gist:3328677
Created August 12, 2012 01:26
Logix Ascii Logo
/*;;.
.;;.
.;;.
.;;. ... ...
.;;. .;;;;;;;; ,;;;;;;;: .. ,;;;;;;, .;;,
.;;. .;;;;....,. :;;;,...:, .;;. :;;,..,;;;. .;;;;
.;;. .;;; :;;: .;;. :;; ,;;;. ;;;;
.;;. ,;; ;;, .;; .;;. ;;;, .,.
.;;. ;;; .;;. .;; .;;. ;;;.
.;;. ;;; :;;. ,;; .;;. :. :;;;.
@bgallagh3r
bgallagh3r / page.php
Created August 5, 2012 03:05
WordPress: Fetch image attachments from child pages.
<?php
global $post;
// Get All children of current page.
$children = get_pages(array('child_of' => $post->ID));
// Increment value.
$i = 0;
foreach ($children as $child){
// Get Image Source
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $child->ID ), 'thumbnail' );
// Get Child Title to use as ALT
@bgallagh3r
bgallagh3r / gist:3151989
Created July 20, 2012 17:19 — forked from panicsteve/gist:1641705
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
@bgallagh3r
bgallagh3r / wp.sh
Last active March 24, 2024 03:12
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@bgallagh3r
bgallagh3r / gist:2852576
Created June 1, 2012 14:37
Wordpress: Filter to remove image dimension attributes (width and height)
<?php
function remove_thumbnail_dimensions( $html ) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );
add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );
// Removes attached image sizes as well
add_filter( 'the_content', 'remove_thumbnail_dimensions', 10 );
?>
@bgallagh3r
bgallagh3r / add_slug_to_body_class.php
Created May 31, 2012 14:35 — forked from keirwhitaker/add_slug_to_body_class.php
WordPress Page Template Snag Lists
<?php
// Add the filter and function to your functions.php file
add_filter('body_class', 'add_slug_to_body_class');
function add_slug_to_body_class($classes) {
global $post;
if(is_page()) {
$classes[] = sanitize_html_class($post->post_name);
} elseif(is_singular()) {
@bgallagh3r
bgallagh3r / disable-plugins-when-doing-local-dev.php
Created May 31, 2012 14:32 — forked from LogixRepo/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@bgallagh3r
bgallagh3r / fetch.sublime-settings
Last active April 8, 2018 02:52
Fetch settings
{
"files":
{
"jQuery": "http://code.jquery.com/jquery.min.js",
"modernizr.js": "https://raw.github.com/Modernizr/Modernizr/master/modernizr.js",
"normalize.css": "https://github.com/necolas/normalize.css/raw/master/normalize.css",
"respond.js": "https://raw.github.com/scottjehl/Respond/master/respond.min.js",
"animate.css": "https://raw.github.com/daneden/animate.css/master/animate.css",
"h5bp index": "https://raw.github.com/h5bp/html5-boilerplate/master/index.html"
},