Skip to content

Instantly share code, notes, and snippets.

View kadamwhite's full-sized avatar

K Adam White kadamwhite

View GitHub Profile
@kadamwhite
kadamwhite / analyze-image.pde
Created January 28, 2015 04:05
Take an image and recreate it with greyscale circles
// Declaring a variable of type PImage
PImage img;
// Define a function to turn an X and Y value into a one-dimensional
// array index, for use with acquiring individual pixels from the image
int getPixelIndex( int x, int y ) {
// Images are a set width: for each increase in y, we've
// effectively gone one width to the right and then wrapped
// around to the next line. Multiply the width by the number
// of times that wrapping has occurred (which line we are on,
@kadamwhite
kadamwhite / brainstorming.md
Last active August 29, 2015 14:13
architecture-of-the-community.md

original outline

  • We architect applications for transparency and intercommunication, but our community is silo'd
  • Grunt vs Gulp, etc are false dichotomies
  • Many/most of us are in this business because we found a welcoming community: key component of the open part of open source
  • Current landscape appears sectarian, polarizing
  • We are not in opposing castles, we are living in cities inextricably linked by trade routes
  • We should take a step back and re-architect our community, with the same mindfulness we take in our applications
  • But in the community, two modules (groups) that do similar things are a strength: competition used to be considered a good thing! We wouldn't have Ember, Angular, etc or any of the others if it existed in isolation. Backbone is still relevant, and still inspiring new ideas (look at ampersand, new developments in marionette)
  • Relevancy and utility are not correlated to novelty
@kadamwhite
kadamwhite / config.json
Last active August 29, 2015 14:07 — forked from anonymous/config.json
Custom bootstrap configuration for node wp demo
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 46.7%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#84bfed",
"@brand-success": "#975bfb",
"@brand-info": "#f2d890",
@kadamwhite
kadamwhite / package.json
Created July 17, 2014 20:06
My best time: 9ms!
{
"name": "dream-speedrun",
"description": "Run through dream.js as fast as possible",
"main": "speedrun.js",
"scripts": {
"start": "node speedrun.js"
},
"license": "WTFPL"
}
@kadamwhite
kadamwhite / private-query-vars.js
Created June 24, 2014 00:22
Query vars for WP-API, trying to understand how everything works
module.exports = [
'offset', // (int) - number of post to displace or pass over. Warning: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination (Click here for a workaround). The 'offset' parameter is ignored when 'posts_per_page'=>-1 (show all posts) is used.
'posts_per_archive_page', // (int) - number of posts to show per page - on archive pages only. Over-rides posts_per_page and showposts on pages where is_archive() or is_search() would be true.
// 'showposts', // <replaced by posts_per_page>
'nopaging', // (boolean) - show all posts or use pagination. Default value is 'false', use paging.
'post_type', // (string / array) - use post types. Retrieves posts by Post Types, default value is 'post'.
'post_status', // (string / array) - use post status. Retrieves posts by Post Status. Default value is 'publish', but if the user is logged in, 'private' is added.
'category__in', // (array) - use ca
@kadamwhite
kadamwhite / types-into-taxes.diff
Last active August 29, 2015 14:01
Proposed solution for embedding custom types into taxonomies
diff --git a/lib/class-wp-json-posts.php b/lib/class-wp-json-posts.php
index 941c796..a06ed0f 100644
--- a/lib/class-wp-json-posts.php
+++ b/lib/class-wp-json-posts.php
@@ -519,9 +519,10 @@ class WP_JSON_Posts {
*
* @param string|object $type Type name, or type object (internal use)
* @param boolean $_in_collection Is this in a collection? (internal use)
+ * @param boolean $_in_taxonomy Is this request being added to a taxonomy record? (internal use)
* @return array Post type data
@kadamwhite
kadamwhite / types-into-taxes.diff
Created May 28, 2014 19:13
Proposed solution for embedding custom types into taxonomies
diff --git a/lib/class-wp-json-posts.php b/lib/class-wp-json-posts.php
index 941c796..a06ed0f 100644
--- a/lib/class-wp-json-posts.php
+++ b/lib/class-wp-json-posts.php
@@ -519,9 +519,10 @@ class WP_JSON_Posts {
*
* @param string|object $type Type name, or type object (internal use)
* @param boolean $_in_collection Is this in a collection? (internal use)
+ * @param boolean $_in_taxonomy Is this request being added to a taxonomy record? (internal use)
* @return array Post type data
@kadamwhite
kadamwhite / 505-bad-gateway.diff
Created May 28, 2014 18:09
If I try to call $this->get_post_type inside a filter function, I get a 502 bad gateway error.
diff --git a/lib/class-wp-json-posts.php b/lib/class-wp-json-posts.php
index 941c796..599e8af 100644
--- a/lib/class-wp-json-posts.php
+++ b/lib/class-wp-json-posts.php
@@ -1090,6 +1090,23 @@ class WP_JSON_Posts {
}
/**
+ * Embed post type data into taxonomy data
+ *
@kadamwhite
kadamwhite / barcodes.js
Created April 10, 2014 15:23
Bar Code generator
$('body').append('<div class="container"></div>');
_.times(10, function() {
_.times(100, function(){
var $div = $('<div/>');
$div.addClass('line');
var rand = Math.random();
if (rand < 0.33) {
$div.addClass('left');
} else if (rand > .67) {
@kadamwhite
kadamwhite / mmadness.logo
Created March 17, 2014 23:29
iterative code to make a March Madness-style bracket, runnable at http://www.calormen.com/jslogo/