Skip to content

Instantly share code, notes, and snippets.

View JeffreyWay's full-sized avatar

Jeffrey Way JeffreyWay

View GitHub Profile
<?php
#functions.php
function chrisypoo_add_custom_types( $query ) {
if( is_category() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(
'post', 'screenshot'
));
<?php global $query_string; ?>
<?php query_posts($query_string . '&post_type=screenshot'); ?>
@JeffreyWay
JeffreyWay / gist:1374162
Created November 17, 2011 19:22
Prompt IE6 for Chrome Frame Install
<!--[if lt IE 7 ]>
<script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<script>CFInstall.check();</script>
<![endif]-->
Comment by David Mark:
"We should get this out into the open. There seems to be a commonly held belief that jQuery users are ignorant, and, more often than not, designers. Where did this come from, and is it true?"
Hi there... and yes *most* jQuery users are designers with no need to learn programming (let alone cross-browser scripting). That's fine for them as they only need to make mock-ups, not production Websites.
"Roots"
Hi there, again. :)
@JeffreyWay
JeffreyWay / thing.php
Created November 29, 2011 22:11
Turn querystring into associative array
$querystring = 'first=jeff&last=way';
$final = array();
foreach( explode('&', $querystring) as $p ) {
list($key, $value) = explode('=', $p);
$final[$key] = $value;
}
// Test it
echo "<pre>";
@JeffreyWay
JeffreyWay / progressPolyfills.js
Created December 14, 2011 04:17
Progress Polyfill
// Get files here: https://github.com/LeaVerou/HTML5-Progress-polyfill
// Also get custom build of Modernizr - with Modernizr.load, and the Community Progress add-on
Modernizr.load({
test: Modernizr.progressbar,
nope: [
'js/progressPoly.js',
'css/progressPoly.css'
]
});
@JeffreyWay
JeffreyWay / gist:1544440
Created December 31, 2011 16:06
Local XHR in Chrome
# Add to ~/.bash_profile
function chrome() {
open $@ --args --allow-file-access-from-files
}
# Usage - chrome index.html
# now you don't have to worry about those pesky local XHR issues in Chrome.
@JeffreyWay
JeffreyWay / bash
Created January 6, 2012 02:17
Run Generated CSS Through Prefixr.com on Save with LiveReload
css="`cat style.css`" && curl -sSd css="$css" http://prefixr.com/api/index.php > style.css
@JeffreyWay
JeffreyWay / jquery-method.html
Created January 20, 2012 20:04
Envato Marketplace API - Get All Items From Collection
<!doctype html>
<html>
<head>
<title>All Items in a Collection</title>
<style>
li {
list-style: none;
float: left;
}
</style>
var addEvent = (function () {
   var filter = function(el, type, fn) {
      for ( var i = 0, len = el.length; i < len; i++ ) {
         addEvent(el[i], type, fn);
      }
   };
   if ( document.addEventListener ) {
      return function (el, type, fn) {
         if ( el && el.nodeName || el === window ) {
            el.addEventListener(type, fn, false);