This file contains 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
var FacebookAPI = function(app_id, app_secret) { | |
return { | |
auth_url : "https://graph.facebook.com/oauth/access_token?"+ | |
"client_id=" + app_id + | |
"&client_secret=" + app_secret + | |
"&grant_type=client_credentials", | |
setAppToken: function(app_token){ | |
this.app_token = app_token; |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head></head> | |
<body> | |
<script type="text/javascript" src="https://cdn.jsdelivr.net/parse/1.2.9/parse.min.js"></script> | |
<script> | |
Parse.initialize('parse app id', 'parse app key'); | |
Parse.Cloud.run('userFriends') | |
.always(function (res) { | |
console.log(JSON.parse(res.message)); |
This file contains 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
Using MongoDB in golang with mgo |
This file contains 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
package main | |
import ( | |
"fmt" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"time" | |
) | |
type Person struct { |
This file contains 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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"net/http" | |
) |
This file contains 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
package main | |
import ( | |
"crypto/rand" | |
"crypto/sha1" | |
"code.google.com/p/go.crypto/pbkdf2" | |
"bytes" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
) |
This file contains 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
// in invite.js module: | |
exports.inviteUser = function(creatingUser,email,tempPass,response) | |
{ | |
"use strict"; | |
if (!tempPass) { | |
tempPass = genRandomPass(); | |
} | |
var user = new Parse.User(); | |
user.set ("username", email); |
This file contains 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
Parse.Cloud.define("loadChannelsFromDate", function(request, response) { | |
var fromDate = request.params.fromDate; | |
var toDate = request.params.toDate; | |
var count = request.params.count; | |
var query = new Parse.Query("archupObject"); | |
query.limit = count; | |
if(fromDate){ | |
query.greaterThan("updatedAt", fromDate); |
This file contains 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
Parse.Cloud.define("NearByAds", nearByAds); | |
Parse.Cloud.define("myAds", myAds); | |
var locationUtil = require('cloud/latlon.js'); | |
/* | |
* limit is kInitialObjectsPerPageNum(100) | |
* oredered by descending adDate and createdAt | |
* kSpecialPropertyKeyApproved(approved) is YES | |
* kSpecialPropertyKeyDeleted(deleted) is NO |