Skip to content

Instantly share code, notes, and snippets.

"""Extract nested values from a JSON tree."""
def json_extract(obj, key):
"""Recursively fetch values from nested JSON."""
arr = []
def extract(obj, arr, key):
"""Recursively search for values of key in JSON tree."""
if isinstance(obj, dict):
@witzketh
witzketh / printrbot_simple_metal.json
Created November 7, 2020 06:45 — forked from fieldOfView/printrbot_simple_metal.json
Printrbot Simple Metal Cura profile
{
"id": "printrbot_simple_metal",
"name": "Printrbot Simple Metal",
"version": 1,
"manufacturer": "Other",
"inherits": "fdmprinter.json",
"machine_settings": {
"machine_width": {
"default": 250
},
<?php
// Allow subscribers to see Private posts and pages
$subRole = get_role( 'subscriber' );
$subRole->add_cap( 'read_private_posts' );
$subRole->add_cap( 'read_private_pages' );
// Redirect to home page on login
function loginRedirect( $redirect_to, $request_redirect_to, $user ) {
if ( is_a( $user, 'WP_User' ) && $user->has_cap( 'edit_posts' ) === false ) {