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.beforeSave("Requests", function(request, response) { | |
var postObj = new Parse.Object("Posts"); | |
postObj.set("objectId", request.object.get("Post_Pointer")); | |
var query = new Parse.Query("Requests"); | |
query.equalTo("Post_Pointer", postObj); | |
query.equalTo("Requester", Parse.User.current()); | |
query.first({ | |
success: function(object) { | |
if (object) { |
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.beforeSave("Posts", function(request, response) { | |
if (request.object.existed()) { | |
return response.success(); // the Post already exist, this must be an Update action | |
} | |
// do a query to "Posts" to check the oldest related "Posts" to current user | |
var query = new Parse.Query("Posts"); | |
query.equalTo("PostUser", Parse.User.current()); | |
query.equalTo("Topic", YOUR_REFERENCED_TOPIC_OBJECT); // assume you are want to reference it by pointer | |
query.descending("createdAt"); |
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("testSave", function(request, response) { | |
var id = request.params.class1Id; | |
var query = new Parse.Query('Class1'); | |
query.include('Class2Pointer'); | |
query.get(id).then(function (Class1) { | |
var Class2 = Class1.get('Class2Pointer'); | |
Class2.set('text', 'snoopy'); | |
// test 1: this will have duplicate save two times | |
Class2.set('Class1Pointer', Class1); | |
// test 2: this will save once |
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
/* | |
* Author: Felipe Herranz ([email protected]) | |
* Contributors:Francesco Verheye ([email protected]) | |
* Israel Dominguez ([email protected]) | |
*/ | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import android.os.Handler; |
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("TestUpload", function(request, response) { | |
var attachmentURLs = []; | |
attachmentURLs.push({'name': 'gogole_logo', 'url': 'https://www.google.com.tw/intl/en_ALL/images/srpr/logo11w.png', 'content-type': 'image/png'}); | |
attachmentURLs.push({'name': 'yahoo_logo', 'url': 'https://www.google.com.tw/images/nav_logo225.png', 'content-type': 'image/png'}); | |
var promises = []; | |
attachmentURLs.forEach(function(file){ | |
promises.push(Parse.Cloud.httpRequest({ | |
url: file.url, | |
}).then(function(fetchedFile){ |
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 queryAllUser = new Parse.Query(Parse.User); | |
Parse.Cloud.useMasterKey(); | |
queryAllUser.each(function(user) { | |
var queryMatch = new Parse.Query(Parse.User); | |
queryMatch.containedIn("offer", user.get("search")); | |
return query.find().then(function(users) { | |
if (users.length >0) { | |
var targetList = []; | |
for (i = 0; i < users.length; i++) { | |
var userPointer = Parse.Object.extend(Parse.User); |
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
// resend verify email | |
Parse.Cloud.define("ResendVerifyEmail", function(request, response) { | |
var user = Parse.User.current(); | |
if (!user) { | |
response.error("INVALID_USER"); | |
return; | |
} | |
var email = request.params.email; | |
var query = new Parse.Query(Parse.User); | |
Parse.Cloud.useMasterKey(); |
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
Coursera course | |
https://www.coursera.org/learn/machine-learning | |
Week 1 Note: | |
Partial derivative in gradient descent for two variables | |
https://math.stackexchange.com/questions/70728/partial-derivative-in-gradient-descent-for-two-variables/189792#189792 | |
Gradient descent | |
https://www.youtube.com/watch?v=WnqQrPNYz5Q&ab_channel=AlexanderIhler |
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
// Google Play API Key | |
// ref: http://stackoverflow.com/questions/35127086/android-inapp-purchase-receipt-validation-google-play | |
// ref: https://developers.google.com/android-publisher/authorization | |
// ref: http://google.github.io/google-api-nodejs-client/18.0.0/index.html#toc14__anchor | |
// | |
// install npm package | |
// ref: https://github.com/google/google-api-nodejs-client | |
// $ npm install googleapis --save | |
// | |
const google = require('googleapis'); |
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
// 1. add a executable dev.sh to run your script (example: web.js) | |
#!/bin/bash | |
node --inspect web.js | |
// 2. install foreman | |
$ npm install -g foreman | |
// 3. prepare your environment variables file | |
$ touch .env |
OlderNewer