Skip to content

Instantly share code, notes, and snippets.

View rexxars's full-sized avatar

Espen Hovlandsdal rexxars

View GitHub Profile
<?php
new AuthArrayAdapter([
// Shorthand/old style access (read+write for all endpoints)
'oldPubKey' => 'oldPrivKey',
'pubKey1' => [
'someRoPrivateKey' => ['images.get', 'image.get', 'metadata.get'],
'someRwPrivateKey' => ['images.post', 'image.put', 'metadata.post']
],
@rexxars
rexxars / gist:8ce51e1b2dec75275919
Created August 15, 2014 13:42
SortBy with deep object access
'use strict';
function deep(obj, prop) {
var segs = prop.split('.');
while (segs.length) {
obj = obj[segs.shift()];
}
return obj;
}
// In some app (say, a flickr-image-app):
appApi.emit('image-selected-for-upload', { url: someUrl, source: 'flickr' })
appApi.on('image-uploaded', function(e) {
if (e.data.source !== 'flickr') {
return;
}
alert('Image uploaded');
});