Skip to content

Instantly share code, notes, and snippets.

View jaredwilli's full-sized avatar
🏄‍♂️

Jared Williams jaredwilli

🏄‍♂️
View GitHub Profile
<?php
/**
* Name: Attachments Metabox Uploader
* Author: Jared Williams - http://new2wp.com
* Description: This is for adding a custom metabox to post types which enables you to add/remove
* post attachments that you can upload and enter the meta information for right on the edit page.
* Version: 0.1.0
*
* @usage: In order to add this to a post type you need to find the word 'product' and replace
* it with whatever the post type is you want to use it on.
@jaredwilli
jaredwilli / Recent Custom Posts Widget
Created February 2, 2011 06:27
Extends the WordPress Recent Posts widget to support custom post types
<?php
/*
define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', home_url() . '/' ) );
define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', site_url() . '/' ) );
define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
define('PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) );
*/
define( 'WPH_FUNC_PATH', get_template_directory() . '/functions' );
define( 'WPH_FUNC_URL', get_bloginfo('template_directory' ).'/functions' );
@jaredwilli
jaredwilli / Attachment Uploader Metabox
Created February 10, 2011 07:03
Need to save or refresh post after adding new input group to make the ajax upload init
<?php
/**
* Name: Attachments Metabox Uploader
* Author: Jared Williams - http://new2wp.com
* Description: This is for adding a custom metabox to post types which enables you to add/remove
* post attachments that you can upload and enter the meta information for right on the edit page.
* Version: 0.1.0
*
* Notes: In order to add this to a post type you need to find the word 'product' and replace it with * whatever the post type is you want to use it on.
*/
///////////////////////////////////////////////////////////////////////////////////////////
// CODE TO ADD POST PER PAGE FILTER
///////////////////////////////////////////////////////////////////////////////////////////
add_filter( 'edit_posts_per_page', 'reorder_edit_posts_per_page', 10, 2 );
function reorder_edit_posts_per_page( $per_page, $post_type ) {
// CHECK USER PERMISSIONS
if ( !current_user_can('edit_others_pages') )
return;
$post_type_object = get_post_type_object( $post_type );
@jaredwilli
jaredwilli / nav-menu.js
Created February 10, 2011 14:48
WordPress navmenu sortable drag/drop script unpacked
var wpNavMenu;
(function (b) {
var a = wpNavMenu = {
options: {
menuItemDepthPerLevel: 30,
globalMaxDepth: 11
},
menuList: undefined,
targetList: undefined,
menusChanged: false,
/*!
* jQuery whenthen - v0.2 - 3/12/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
@jaredwilli
jaredwilli / preloader.js
Created May 7, 2011 19:16 — forked from adamesque/preloader.js
Uses jQuery's new Deferred object to help with image loading
/**
* Helper function for passing arrays of promises to $.when
*/
jQuery.whenArray = function ( array ) {
return jQuery.when.apply( this, array );
};
/**
* Accepts a single image src or an array of image srcs.
@jaredwilli
jaredwilli / gist:1005782
Created June 3, 2011 02:55
get images from folder
<?php
$size = $_POST['size'] ? $_POST['size'] : 'm';
$dir = @dir( $_POST['dir'] . $size ) ? @dir( $_POST['dir'] . $size ) : @dir( 'images' . $size );
while(( $file = $dir->read() ) !== false ) {
return $file;
}
$dir->close();
?>
@jaredwilli
jaredwilli / gameengines.md
Created July 26, 2011 17:46 — forked from bebraw/gameengines.md
List of JS game engines. You can find a wikified version at https://github.com/bebraw/jswiki/wiki/Game-Engines. Feel free to modify that. I sync it here every once in a while.

IMPORTANT! Remember to check out the wiki page at https://github.com/bebraw/jswiki/wiki/Game-Engines for the most up to date version.

Name Latest Release Size (KB) License Type Unit Tests Docs Repository Notes
Akihabara 1.3.1 (2011/05) 453 GPL2, MIT Classic Repro no API github Intended for making classic arcade-style games in JS+HTML5
Aves Commer-cial Obsolete. Company bought by Zynga. E3 2010 Aves Engine Prototype "Suburban World"
bdge github Badly Design Game Engine, an HTML5 Javascript game engine [Demo](h
@jaredwilli
jaredwilli / gist:1109305
Created July 27, 2011 12:56
visualizations and animation js frameworks
Canvas pie chart with tooltips - http://demos.greghoustondesign.com/piechart/
Three.js - https://github.com/mrdoob/three.js
Infiview - http://www.infiview.com/
Rgraphviz - http://www.bioconductor.org/packages/release/bioc/html/Rgraphviz.html
http://bioconductor.org/packages/2.6/bioc/manuals/Rgraphviz/man/Rgraphviz.pdf