Skip to content

Instantly share code, notes, and snippets.

View jakewhiteley's full-sized avatar

jake whiteley jakewhiteley

View GitHub Profile
<?php
/**
* For each page each, loop through registered columns, and output value
* @param String - current column name
* @param Int - current page ID
*/
function populate_column ( $column, $page_id )
{
switch ( $column ) {
// if the current column name is template
<?php
/**
* instructs wordpress that our column is sortable
* @param Array - existing columns from wordpress
* @return Array - column array with new attributes
*/
function register_sortable ( $columns )
{
$columns['template'] = 'template';
return $columns;
<?php
/**
* instruct wordpress what orderby=template means
* @param Array wordpress request rules
* @return Array modified $vars
*/
function template_column_orderby( $vars ) {
// the search extras that will order correctly
if ( isset( $vars['orderby'] ) && 'template' == $vars['orderby'] ) {
$vars = array_merge( $vars, array( // merge the existing search parameters with ours
// preload bitmap font into Phaser
game.load.bitmapFont('font-name', 'path/to/font.png', 'path/to/font-name.fnt');
// render bitmap font to game stage
game.add.bitmapText(0, 0, 'font-name', 'Text to display');
@jakewhiteley
jakewhiteley / jsblocks.js
Last active August 29, 2015 14:22
jsblocks issue
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/css/materialize.min.css">
<script src="http://jsblocks.com/jsblocks/blocks.js"></script>
<script>
var App = blocks.Application({
history: 'pushState'
App.View('Tags', {
options: {
url: AppPath + 'views/tag.html',
route: AppPath +'tag/{{tag}}'
},
tag: 'default',
routed: function (params) {
this.tag = params.tag;
/*
* ** SUMMARY **
* App._router._route should not be empty, but contain a Route object, with the currently mapped URL parameters
* App._router._route could be accessed as App.getRoute()
*
* App._router._route could be accessed as App.getRoutes()
*
* Is there an event which fires internally on a successful route change?
* I realise this would set a precedence, so window events can be used instead. It is just a nice feature, but not 100% needed.
*
@jakewhiteley
jakewhiteley / jsblocks.js
Last active August 29, 2015 14:22
jsblocks observable each() view issue
App.View('Navigation', {
options: {
url: AppPath + 'views/navigation.html',
},
// the current path as an array of URL parts
currentPath: blocks.observable(['Home'])
});
var AppPath = '/teimr/',
App = blocks.Application({
history: 'pushState'
});
App.View('Navigation', {
options: {
url: AppPath + 'views/navigation.html',
},