Skip to content

Instantly share code, notes, and snippets.

<?php
define('VERIFY_TOKEN', 'yourappssecret');
$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);
<?php
define('VERIFY_TOKEN', 'yourappssecret');
$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') {
if ( isset( $_SERVER['HTTP_X_HUB_SIGNATURE'] ) ) {
CREATE TABLE FaceBook (
uid int(15) NOT NULL,
id int(15) NOT NULL,
time int(15) NOT NULL,
changed_fields varchar(20) NOT NULL,
PRIMARY KEY (uid,changed_fields)
);
@AlexanderNorway
AlexanderNorway / anagram.m
Created September 7, 2012 06:13
Anagram Finder
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"eventyr" ofType:@"txt"];
if (filePath) {
NSData *fileData = [NSData dataWithContentsOfFile:filePath];
NSString* words = [[NSString alloc] initWithData:fileData encoding:NSUTF8StringEncoding];
NSMutableArray *lines = [[words componentsSeparatedByString:@"\n"] mutableCopy];
NSMutableArray *possibleMatches = [[NSMutableArray alloc]init];