Skip to content

Instantly share code, notes, and snippets.

View jimpowelltech's full-sized avatar

Jim Powell jimpowelltech

View GitHub Profile
@jimpowelltech
jimpowelltech / JimsonJSON
Created July 31, 2014 16:04
The json_encode replacement for using typed data
<?php
function jimson_encode($a=false) {
// Some basic debugging to ensure we have something returned
if (is_null($a)) return 'null';
if ($a === false) return 'false';
if ($a === true) return 'true';
if (is_scalar($a)) {
if (is_float($a)) {
// Always use '.' for floats.
<?php
isAppropriate($article) {
$audience = $article->field_intended_audience['und'][0]['value'];
// Use the code from the views filter to return either true or false
// !!! You'll need to flip it though, so return true means I should see it
}