splitbrain.org

electronic brain surgery since 2001

Your Questions Answered #5

What does the # command in Twitter do?

What does the glowing blue strip on the Wii mean?

How do I view Pocket Queries?

Who invented the LightBox JavaScript?

How to read the Browser History?

$> sqlite3 ~/.mozilla/firefox/*.default/places.sqlite \\
   'SELECT url, visit_count FROM moz_places ORDER BY visit_count DESC LIMIT 10;'

How to quickly tell who isn't following you back on Twitter?

API

<html>
<head>
    <title>Non-Mutual Twitter friends</title>
</head>
<body>
 
<?php
$user = preg_replace('/[^\w]+/','',$_GET['user']);
 
if(!$user){
    echo '<form action="">Username: <input type="text" name="user" />
          <input type="submit" value="go" /></form>';
}else{
    $api['twitter']  = array('http://twitter.com/','http://twitter.com/');
    $use = 'twitter';
 
    $followers = array();
    $xml = @simplexml_load_file($api[$use][0].'followers/ids/'.$user.'.xml');
    if(!$xml) die('failed to query API, probably hit the limit. Try again later');
    foreach($xml->id as $idnode) $followers[] = (int) $idnode;
    $friends = array();
    $xml = @simplexml_load_file($api[$use][0].'friends/ids/'.$user.'.xml');
    if(!$xml) die('failed to query API, probably hit the limit. Try again later');
    foreach($xml->id as $idnode) $friends[] = (int) $idnode;
    $miss = array_diff($friends,$followers);
 
    echo '<ul>';
    foreach($miss as $id){
        set_time_limit(30);
        $xml = @simplexml_load_file($api[$use][0].'users/show.xml?user_id='.$id);
        if(!$xml) die('failed to query API, probably hit the limit. Try again later');
 
        echo '<li style="clear:left">';
        echo '<img src="'.$xml->profile_image_url.'" align="left" /> ';
        echo '<a href="'.$api[$use][1].htmlspecialchars($xml->screen_name).'">';
        echo htmlspecialchars($xml->name).'<br />('.htmlspecialchars($xml->screen_name).')';
        echo '</a>';
        echo '</li>';
 
        flush();
        ob_flush();
        sleep(2);
 
    }
    echo '</ul>';
}
?>
 
</body>
</html>

Non-mutual Twitter Friends

API;-)

BTWAPI

Tags:
faq, twitter, wii, lightbox, firefox, geocaching
Similar posts:

Comments