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
1. Add the deprecated header "Facebook.h" to your project (it is included in the .framework) | |
2. In the completion handler of opening the session, create a facebook variable and set it's info to the session's info | |
facebook = [[Facebook alloc] initWithAppId:FBSession.activeSession.appID andDelegate:nil]; | |
// Store the Facebook session information | |
facebook.accessToken = FBSession.activeSession.accessToken; | |
facebook.expirationDate = FBSession.activeSession.expirationDate; | |
3. To post to wall use this line (if you add a "to" key to the params dictionary you can post on a friend's wall): | |
[facebook dialog:@"feed" andParams:params andDelegate:self]; |
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
// Epoch time (or unix time) is the number of seconds since Jan 1st 1970 00:00:00 UTC | |
// To convert an NSNumber representing epoch time to an NSDate object: | |
NSNumber *epochTimeOfSomeEvent = [NSNumber numberWithDouble:1357865700]; | |
NSDate * dateOfThatSameEvent = [NSDate dateWithTimeIntervalSince1970:epochTimeOfSomeEvent]; | |
// You can then compare this NSDate to the current date to get useful information from it |
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
def replaceStringInObject(obj, old, new): | |
if isinstance(obj, list): | |
for i in range(len(obj)): | |
if isinstance(obj[i], str) and obj[i] == old: | |
obj[i] = new | |
else: | |
replacestrinobj(obj[i], old, new) | |
elif isinstance(obj, dict): | |
for k in obj: | |
if isinstance(obj[k], str) and obj[k] == old: |
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
import os | |
from urlparse import urlparse | |
from flask import Flask | |
from pymongo import MongoClient | |
MONGO_URL = os.environ.get('MONGOHQ_URL') | |
if MONGO_URL: | |
# Get client | |
client = MongoClient(MONGO_URL) |