Skip to content

Instantly share code, notes, and snippets.

@danshev
danshev / gist:557000a1f8056daba7e7
Last active August 29, 2015 14:19
Server-side monitoring for the dispatch queue.
# Dependency: https://github.com/hashme/firebase-python
# Use with: https://gist.github.com/danshev/4227f07e5859a30e6304
import firebase
import json
from pprint import pprint # function which pretty prints objects
URL = firebase.firebaseURL('therenow/{0}/dispatch-queue'.format(current_app.config["MARKET_DOMAIN_SLUG"]))
def delete_message(path):
@danshev
danshev / gist:4227f07e5859a30e6304
Last active August 29, 2015 14:19
Dispatch() function meant to be used as the callback for .sendMessage() of Firebase's Firechat.
// This is client-side code meant for the callback of Firebase's Firechat .sendMessage(), it
// does two things:
//
// 1. It determines if there are any @mentions in the message. If there are,
// then it determines if the mentioned user(s) are in the chatroom.
//
// a. For each user mentioned who is NOT in the chatroom, a message to them
// is immediately added to the `dispatch-queue` node.
//
// b. For each user mentioned who *is* in the chatroom, then the user's
import Oauth2
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
println("viewDidLoad")
let settings = ["client_id": "abcde",
"client_secret": "12345",
from TwitterAPI import TwitterAPI
api = TwitterAPI("QHCFXKcJeYvFMr8XBTes3eID8",
"Zh3JhEBL8PXnfAEAAOivlB4xrX1PAfDEIdg6DsC78qs6O2Aruk",
"2401578782-7P2QUySnDc8gFHQ1vCwTrckbLLSty8tOFjrizC6",
"WNcilnQcbd0o7xnTYf1XBylsriyBb1KkNlxyTx4u4uB1s"
)
# instantiate empty lists that will hold Event data.
# these would be populated by a periodic (e.g. every 1 minute) query of "active" Events.
event_ids = []