boutell: (Default)
[personal profile] boutell
My jsonwrapper code is currently part of Facebook's official standard library for building Facebook apps in PHP.

I only noticed because I was poking around to make sure I'd unpacked their latest code in the right place and started to worry when I saw what seemed to be my own code in what should have been a brand new folder from Facebook! Hey, what's going on, that's my code... that's... oh yeah, I released it. So they used it. Cool.

Sadly, I put it in the public domain and left out any credit notice in the source out of a sense of modesty: jsonwrapper itself is maybe 30 lines of code, if that, and all it does is wrap somebody else's library that actually implements JSON for poor bastards who still have PHP versions earlier than 5.2 so that you can write code exactly as if you had 5.2. I didn't feel it was appropriate to take ostentatious credit for:

jsonwrapper.php

<?php
# In PHP 5.2 or higher we don't need to bring this in
if (!function_exists('json_encode')) {
        require_once 'jsonwrapper_inner.php';
}
?>
jsonwrapper_inner.php
<?php

require_once 'JSON/JSON.php';

function json_encode($arg)
{
        global $services_json;
        if (!isset($services_json)) {
                $services_json = new Services_JSON();
        }
        return $services_json->encode($arg);
}

function json_decode($arg)
{
        global $services_json;
        if (!isset($services_json)) {
                $services_json = new Services_JSON();
        }
        return $services_json->decode($arg);
}

?>
jsonwrapper has its own home page on my site, so I get some credit for it that way. And besides, taking credit for helping old versions of PHP limp along isn't exactly rock star stuff.

But was it a wise choice on my part not to say "w00t first, copyright me, MIT license, have fun" in a piece of code that might, I don't know, wind up in Facebook's standard client library? Nope. Next time I'll be smarter.

Date: 2009-05-03 09:23 pm (UTC)
From: [identity profile] neoliminal.livejournal.com
Well I think you rock.

Date: 2009-05-04 05:00 pm (UTC)
From: [identity profile] nothings.livejournal.com
I've done pretty well with public domain and an authorship notice; most people aren't sufficiently jerky to delete the notice. But public domain guarantees maximum spread, which I care about more than the credit, so.

September 2014

S M T W T F S
 123456
78910111213
14151617181920
2122232425 2627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Oct. 17th, 2017 10:18 pm
Powered by Dreamwidth Studios