This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" | |
applicationComplete="applicationComplete(event)" > | |
<mx:Script><![CDATA[ | |
import mx.events.FlexEvent; | |
import mx.controls.Image; | |
import flash.events.Event; | |
private var imgURL:String = "http://xerto.free.fr/toad1.jpg"; | |
// Depot, put and get. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "iTunes" | |
copy (convert current track) to newTrack | |
set newLocation to (location of track 1 of current playlist) | |
tell application "Finder" | |
copy (move newLocation to the desktop with replacing) to newFile | |
end tell | |
delete (track 1 of current playlist) | |
do shell script "uptmp " & quote & (POSIX path of newLocation) & quote | |
end tell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'digest/md5' | |
require 'json' | |
require 'net/http' | |
class Facebook | |
public | |
# This is it. | |
def self.callMethod(methodName, args={}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.jubishop.devrs006.facebook.com/login.php?api_key=API_KEY_HERE&next=http://www.jubishop.devrs006.facebook.com/connect/login_success.html&return_session=true&req_perms=offline_access,publish_stream,read_stream,email,create_event,rsvp_event,sms,status_update,photo_upload,video_upload,create_note,share_item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.jubishop.devrs006.facebook.com/login.php?api_key=API_KEY_HERE&next=http://www.jubishop.devrs006.facebook.com/connect/login_success.html&return_session=true&req_perms=offline_access,publish_stream,read_stream,email,create_event,rsvp_event,sms,status_update,photo_upload,video_upload,create_note,share_item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.facebook.com/login.php?api_key=API_KEY_HERE&next=http://www.facebook.com/connect/login_success.html&return_session=true&req_perms=offline_access,publish_stream,read_stream,email,create_event,rsvp_event,sms,status_update,photo_upload,video_upload,create_note,share_item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SlowWatir | |
IndestructibleMethods = ['__id__', '__send__'] | |
SleepTime = 0.5 | |
def self.await(tries = 20) | |
begin | |
result = yield | |
if not result or (result.respond_to? :exists? and not result.exists?) | |
raise Exception.new | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Automate Functional Tests of Your Connect Implementation | |
Here on the Facebook Platform Engineering team we strive to keep Connect fast and stable and to help our developers ensure their implementations are working, bug free. | |
A while back we began working on a suite of Automated tests for some of our top partners that would confirm Connect was always functioning. Then we decided it'd be great if we could create a library that would help any connect developer easily create automated tests of their own site. | |
We've written a library on top of Watir (http://wtr.rubyforge.org/), that helps you deal with all the generic issues needed to stress test a Connect site's implementation. In this post we'll be demonstrating how to use our new library to create automated tests for StreamDiff (http://www.streamdiff.com/) a cool Connect site built by a coworker of mine: Naitik Shah. | |
First, we'll need to install Watir, which is described here: http://wtr.rubyforge.org/install.html . Be sure to get the plugin for Firef |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $weights = array of weights | |
// $num = number of result desired. | |
// returns array of indices chosen from $weights. | |
function pluck($weights, $num) { | |
$chosen = array(); | |
while (count($chosen) < $num) { | |
$sum = array_sum($weights); | |
$plucked = rand(1, $sum); | |
$count = 0; | |
for ($i = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$me = PUT_YOUR_UID_HERE; | |
$friends = user_get_reciprocal_friends($me); | |
$friends_info = user_multiget_basic_info($friends); | |
$male_friends = array(); | |
$female_friends = array(); | |
foreach ($friends_info as $uid => $friend_info) { | |
if (gender_is_male($friend_info['gender'])) { | |
$male_friends[] = $uid; |