Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@phwd
phwd / gist:3745712
Created September 18, 2012 20:39
Pages you own on Facebook
<fb:login-button scope="manage_pages"
onlogin="getAccounts()">
Grant Permissions to Allow access to Pages you admin
</fb:login-button>
<ul id="accounts"></ul>
<script>
window.getAccounts = pullAccounts();
function pullAccounts(){
@phwd
phwd / facebook.py
Created October 10, 2012 18:00
Tornado example of posting to a page (Doesn't handle duplicate posts #506)
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
<?php
$app_id = "APP_ID";
$app_secret = "APP_SECRET";
$my_url = "MY_URL";
session_start();
$code = $_REQUEST["code"];
<?php
require '../src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'APP_ID',
'secret' => 'APP_SECRET',
));
$user = $facebook->getUser();
@phwd
phwd / gist:4558367
Created January 17, 2013 18:34
ruby net/http get requests
require 'net/http'
API_HOST = "graph.facebook.com"
API_BASE_URL = "https://#{API_HOST}"
path = "/boo"
uri = URI.parse "#{API_BASE_URL}#{path}"
http = Net::HTTP.new(uri.host, uri.port)
res = http.get(uri.request_uri, nil)
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEvents 'SELECT datetime(LSQuarantineTimeStamp + 978307200, "unixepoch") as LSQuarantineTimeStamp, LSQuarantineAgentName, LSQuarantineOriginURLString, LSQuarantineDataURLString from LSQuarantineEvent' | sort
<?php
define('VERIFY_TOKEN', 'pancakes');
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'GET' && $_GET['hub_mode'] == 'subscribe' && $_GET['hub_verify_token'] == VERIFY_TOKEN) {
echo $_GET['hub_challenge'];
} else if ($method == 'POST') {
$updates = json_decode(file_get_contents("php://input"), true);
file_put_contents('updates.txt',print_r($updates, true), FILE_APPEND);
<html lang="en">
<head>
<script>
function str2hex(str)
{
var out_str = " ";
for(var i = 0; i < str.length; i++)
{
<html>
<head></head>
<body onload="go()">
<div id="log_div"></div>
<script>
function my_log(message) { document.getElementById('log_div').innerHTML += (message.toString() + "<br />"); }
// wiretap
(window.addEventListener || window.attachEvent)('message', function(e) { console.log('wiretap: ' + e.data); my_log("wiretap: " + e.data); }, false);