Skip to content

Instantly share code, notes, and snippets.

View whyisjake's full-sized avatar
✈️

Jake Spurlock whyisjake

✈️
View GitHub Profile
@whyisjake
whyisjake / theme_stuff.php
Created April 1, 2013 18:00
Bring the content from all post types into tag/author/tax pages.
<?
/**
* Add different content types to the main queries.
* This will bring posts, craft, projects, video into the main query. Allows for better archive pages.
* @return string Main category name.
*/
// TODO: Bring in reviews.
function make_add_custom_types( $query ) {
if ( ! is_admin() && $query->is_main_query() && ( $query->is_tag() || $query->is_author() || $query-> is_tax() ) && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array( 'post', 'craft', 'projects', 'video' ));
<?php
$id = get_queried_object_id();
$name = get_cat_name( $id );
?>
<div class="grey child">
<div class="container">
<div class="row">
@whyisjake
whyisjake / entity.json
Last active December 14, 2015 23:39
First go at the new API.
{
"header": {
"version": "0.5",
"generation_date": "2013-03-15 04:23:04"
},
"entities": {
"0": {
"id": 2115,
"original_id": 2115,
"thumb_img_url": "http://newnewmf.insourcecode.com/wp-content/uploads/2013/02/cyclonecloseup2-500x283.jpg?w=80&h=80&crop=1",
@whyisjake
whyisjake / parts-grabber.php
Created March 6, 2013 01:22
Having issues getting all of the parts data from the Make: Projects API. Should be getting the type, and quantity from the response. Not seeing it here.
<?php
/**
* Trying to grab the parts quantity and the type, but they are missing.
* Check this page: http://makeprojects.com/api/0.1/guide/56 and note the parts array.
*/
header('Content-Type: text/html; charset=utf-8');
$url = 'http://makeprojects.com/api/0.1/guide/56';
$contents = file_get_contents( $url );
//echo $contents;
@whyisjake
whyisjake / browser.json
Created March 5, 2013 23:36
Getting different results from wpcom_vip_file_get_contents, file_get_contents, browser, curl... Trying to pull down this URL: http://makeprojects.com/api/1.0/guide/4
{
"topic": "Cheesemaking",
"url": "http://makeprojects.com/Project/Goat+Cheese/4/1",
"guide": {
"author": {
"text": "Dale Dougherty",
"userid": 2
},
"categories": [
"Cheesemaking",
@whyisjake
whyisjake / hexbright.md
Created February 26, 2013 18:59
Hexbright Review

= HexBright

Started as a Kickstrater project, the Hexbright is not just a bright flashlight, it's also programmable. The Hexbright packs a USB rechargeable Lithium-Ion battery that in the low mode is good for over 30 hours of run time. Out of the box, there are three brightness settings: 50, 150, or 500 lumens. There is also a strobe mode that blinks that flashlight at the 150 lumens setting. Beside the brightness, and the rugged aluminum construction is the onboard, Arduino compatible board that allows the flashlight to be programmed. Community sourced programs feature different brightness settings, morse code, and my favorite, a program that allows you to use the built in accelerometer to vary the brightness of the flashlight by the angle that the flashlight is being held. While not cheap, they start at $99, it's functional tool that offers plenty of features, is compact in size and built to last. It's the perfect addition to any makers toolbox.

@whyisjake
whyisjake / gist:5040906
Created February 26, 2013 18:37
Testing.
Here is my new gist.
<?php
$arr = array('http://placekitten.com/300/250', 'http://placekitten.com/400/150');
$shuffle = array_rand($arr, 1);
// print_r($shuffle);
echo '<img src="' . esc_url( $arr[$shuffle] ) . '" />';
@whyisjake
whyisjake / gist:5032414
Created February 25, 2013 19:19
Simple image swapper
<?php
$arr = array('http://placekitten.com/300/250', 'http://placekitten.com/400/150');
$shuffle = array_rand($arr, 1);
// print_r($shuffle);
echo '<img src="' . esc_url( $arr[$shuffle] ) . '" />';
@whyisjake
whyisjake / gist:5032413
Created February 25, 2013 19:19
Simple image swapper
<?php
$arr = array('http://placekitten.com/300/250', 'http://placekitten.com/400/150');
$shuffle = array_rand($arr, 1);
// print_r($shuffle);
echo '<img src="' . esc_url( $arr[$shuffle] ) . '" />';