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
Using MongoDB in golang with mgo |
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
<!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 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
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 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
package main | |
import ( | |
"fmt" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"log" | |
"os" | |
"strings" | |
"text/tabwriter" |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"github.com/globocom/tsuru/db/storage" | |
"github.com/gorilla/feeds" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"net/http" |
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
[PFCloud callFunctionInBackground:@"capability" | |
withParameters:nil | |
block:^(NSString *token, NSError *error) { | |
TCDevice *device = [TCDevice initWithTokenOrWhateverIForget:token]; | |
}]; |
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
Parse.Cloud.define("friends", function(request, response){ | |
var query = new Parse.Query("User"); | |
query.containedIn("facebook_id", request.params.facebook_ids_array); | |
query.find({ | |
success: function(results){ | |
var friendIDs = new Array(); | |
for (var i = 0; i < results.length; i++) | |
{ | |
friendIDs.push(results[i].get('facebook_id')); | |
} |
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
package main | |
import ( | |
"fmt" | |
"github.com/codegangsta/martini" | |
"github.com/martini-contrib/binding" | |
"github.com/martini-contrib/render" | |
"github.com/martini-contrib/secure" | |
"github.com/martini-contrib/sessions" | |
"github.com/ottemo/ottemo-go/auth" |
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
Parse.Cloud.beforeSave('Post', function (request, respond) { | |
var post = request.object; | |
var prevCatId = post.get('prevCat').id; | |
var catId = post.get('cat').id; | |
if (post.dirty('cat')) { | |
var prev = new Parse.Query('Category'); | |
prev.get(prevCatId, { | |
success: function (category) { | |
// Decrement old category post count. |
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
package signatures | |
import ( | |
"github.com/go-martini/martini" | |
"github.com/martini-contrib/binding" | |
"github.com/martini-contrib/render" | |
"labix.org/v2/mgo" | |
) | |
type Server *martini.ClassicMartini |