opengraphlogo So, I needed a simple open graph library for a project. There are other libraries, but I just needed something simple and quick, so I bashed this library together.

The library contains a class with a single static function, you pass it some page contents, and it’ll spit back a key => value array containing any open graph entries in the page.

This was handy for me, it might be for you 🙂

» Visit the project on Github…

If you’re like me, you have a number of servers running on the wider internet. These servers generate a whole bunch of system emails that are really valuable to an administrator to keep track of the health of their system, but could also give valuable and exploitable information about your system to the bad guys, and since many administrators automatically forward these emails to an external address, it’d be handy if they were automatically encrypted.

Thankfully, on unix at least, this is relatively straightforward.

Setting up an encrypted forward…

  1. Firstly, install the packages you need:

    apt-get install procmail gnupg

  2. Next, in the account you use to forward your email (usually root email is redirected to a non-privileged user, check /etc/aliases), install the public key of the account you’re forwarding messages to:

    gpg --import /path/to/public.key

  3. Now, install the following script in ~/.procmailrc:


    SUBJECT=`formail -xSubject:`
    FROM=`formail -xFrom:`
    :0 c
    *^To:.*root.*
    |formail -I "" | gpg --trust-model always -ear "you@example.com" | mail -r "$FROM" -s "$SUBJECT" you@example.com

If this works, you’ll have an unencrypted copy of the email left on the server, but anything that gets sent externally will be encrypted with your public key.

Thanks to DRG, for the original script for this, which I modified.

Hovercards are business card like popups which appear when your mouse hovers over, for example, a user name.

They’re useful to display summary information without the requirement for the visitor to click on a link and navigate away from the current page.

I needed this functionality for a couple of client sites, so I put together a quick Elgg plugin to implement hovercard functionality via the very cool hovercard.js library written by Prashant Chaudhary.

Out of the box, the plugin provides hovercard functionality for most occurrences of a user’s name in user listings and the site river. I didn’t want to get too carried away, since I was in a hurry and I didn’t want to override every user view in Elgg! However, you should be able to see how I used the view system to provide a hovercard view on the data.

Usage

Checkout the repository and install it into your mod directory as elgg-hovercard, and activate it in the usual way.

The plugin makes use of the Elgg view system and creates a hovercard data view on user objects, accessible by appending a view=hovercard onto any profile URL. This endpoint returns a JSONP object containing basic hovercard profile data, which is automatically rendered by hovercard.js.

The simplest way to display a hovercard for a user is to use this endpoint via the data-hovercard attribute, e.g.

<a class="hovercard-custom" data-hovercard="<?= $user->getUrl(); ?>?view=hovercard" href="<?= $user->getUrl(); ?>"><?= $user->name; ?></a>

This code (which I have highlighted the important parts of), will cause the library to fetch the hovercard data for the given user via ajax.

To provide further customisation, or to display hovercards for things other than user details, you can take advantage of the output/hovercard view, passing it the contents of the hovercard and a jquery style selector to bind to.

Anyway, have a play!

» Visit the project on Github…