Skip to content

Instantly share code, notes, and snippets.

View rosschapman's full-sized avatar

Ross Chapman rosschapman

View GitHub Profile
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="200" height="230" id="FM3" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="allowFullScreen" value="false" /> <param name="movie" value="http://www.zendesk.com/media/FM3.swf" /> <param name="quality" value="high" /> <param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /> <embed src="http://www.zendesk.com/media/FM3.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="200" height="230" name="FM3" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object/>
@rosschapman
rosschapman / last_term.php
Created April 2, 2012 22:15
Way to get last term of get_terms array in #wordpress
$terms = get_the_terms($post->ID, $taxonomy);
end($terms);
$term_id = key($terms);
$term = get_term($term_id,$taxonomy);
echo $term->name;
@rosschapman
rosschapman / gist:2705595
Created May 15, 2012 22:23
Casper multi-page 404 tester
/*
* 404 Checker
*
*/
var casper = require('casper').create({
loadImages: false,
javascriptEnabled: false,
loadPlugins: false,
verbose: true,
@rosschapman
rosschapman / wp-ssl.php
Last active December 12, 2015 00:48
Sample for #wordpress SSL admin
* Force admin over SSL
*/
define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
@rosschapman
rosschapman / ff-only.scss
Created July 1, 2013 21:03
Firefox only SASS mixin
@mixin FF-only {
@-moz-document url-prefix() { @content; }
}
<?php
function not_foo( $class ) {
if ( get_bloginfo('name') != 'foo' ) {
$class[] = 'not_foo';
}
else {};
return $class;
}
@rosschapman
rosschapman / wp_get_category_names_for_any_post.php
Created July 1, 2013 21:06
wp_get_category_names_for_any_post.php #wordpress
<?php
function get_category_names_for_any_post(){
// Create empty array for later
$categoriesArray = array();
// Get current post type
$curentPostType = get_post_type($post->ID);
@rosschapman
rosschapman / post-no-reload.js
Created July 1, 2013 21:09
Post form data to Marketo w/o page reload (JavaScript)
function postToMarketo() {
var form = $('<form class="marketo-form" method="post" enctype="application/x-www-form-urlencoded" action="http://info.domain.com/index.php/leadCapture/save" id="mktForm_ID" name="mktForm_ID">');
var inputArr = {};
var selectedArr = {};
var key;
var inputs = $('form.leadgen input');
var selected = $('form.leadgen option[selected]');
var iframe = $('<iframe style="display:none;" id="new-form" src="/marketo_success.html"></iframe>');
@rosschapman
rosschapman / download-things-with-node.js
Last active December 19, 2015 05:29
download-things-with-node.js
var fs = require('fs');
var mkdirp = require('mkdirp');
var request = require('request');
localPathToThing = '/path/to/things';
arrayOfUrls = ['http://all-the-things.com/thing-1.png','http://all-the-things.com/thing-2.png','http://all-the-things.com/thing-3.png', ...]
arrayOfUrls.forEach(function(url,index){
@rosschapman
rosschapman / i18n_style_switch.php
Last active December 19, 2015 09:59
i18n Conditional Style Loader v2 #wordpress
if( $blog_id !== '1' ) {
echo '<link rel="stylesheet" type="text/css" media="all" href="/screen_i18n.css">';
} else {
echo '<link rel="stylesheet" type="text/css" media="all" href="/screen.css" />';
}