Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 45 lines (37 sloc) 0.999 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
$j = jQuery

reverse = (s) ->
  if s.length < 2 then s else reverse(s[1..-1]) + s[0]

query="""
SELECT name, uid
FROM user
WHERE uid IN (
SELECT uid2
FROM friend
WHERE uid1=me()
)
AND strpos(lower(name),"a") >=0
AND uid > 100000000000000
AND uid < 100001854470625

"""

myInfo = $j ("#myinfo").empty()
for key, value of response
  myInfo.append "<tr><td>#{key}</td><td>#{value}</td></tr>"

getMyInfo = (callback) ->
  FB.api '/me', {fields:['id','first_name','last_name']}, callback


window.fbAsyncInit = ->
  FB.init
    appId: '340097046032196' #put your own appId here
    status: true
    cookie: true
    xfbml: true
    oauth: true

$j ->
  id = 'facebook-jssdk'
  return if $j(id).length > 0
  sdk = $j.getScript "http://connect.facebook.net/en_US/all.js"
  sdk.id = id
  sdk.async = true
  $j('#show_profile').click ->
    getMyInfo((resp) -> console.log JSON.stringify(resp))
  $j('#query').click ->
    FB.api '/fql',{q:query} , (resp) -> console.log JSON.stringify(resp)
Something went wrong with that request. Please try again.