Skip to content

Instantly share code, notes, and snippets.

View bookchiq's full-sized avatar

Sarah Lewis bookchiq

View GitHub Profile
@bookchiq
bookchiq / wp-autopopulate-taxonomy.php
Last active October 16, 2018 21:12 — forked from brenna/wp-autopopulate-taxonomy
WordPress function to auto-populate a taxonomy with a custom post type's entries.
<?php
/**
* Register our custom taxonomy.
*
* @return void
*/
function gist_5f2e8bcd3217698fb4947e120f178686_custom_tax_init() {
// Set some options for our new custom taxonomy.
$args = array(
'label' => __( 'My Custom Taxonomy' ),
#!/usr/bin/env python
"""
Quick script to beemind entering at least some meals into MyFitnessPal for the day.
Setup instructions:
- install myfitnesspal, requests and keyring (if you don't have them)
- call keyring.set_password("myfitnesspal", <your_username>, <your_password>)
- call keyring.set_password("beeminder", <your_username>, <your_api_key>)
@bookchiq
bookchiq / wordpress-post-thumbnail-or-first-image-or-default.php
Last active August 29, 2015 14:08 — forked from brajeshwar/wordpress-post-thumbnail-or-first-image-or-default.php
WordPress: get the Featured Image or fall back to the first image of a post
function jewish_food_hero_get_best_image( $size = 'full' ) {
$image_data = array();
if ( has_post_thumbnail() ) {
$image_id = get_post_thumbnail_id();
$image_data_raw = wp_get_attachment_image_src($image_id, $size);
$image_data['url'] = $image_data_raw[0];
$image_data['width'] = $image_data_raw[1];
$image_data['height'] = $image_data_raw[2];
} else {
@bookchiq
bookchiq / javascript_resources.md
Last active August 29, 2015 14:06 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage