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
| private JSONArray cloudant; | |
| private JSONObject cloudantInstance; | |
| private JSONObject cloudantCredentials; | |
| public CloudantClient() | |
| { | |
| this.httpClient = null; | |
| try { | |
| String VCAP_SERVICES = System.getenv("VCAP_SERVICES"); |
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
| public CloudantClient() | |
| { | |
| this.httpClient = null; | |
| //TODO read env VCAP_SERVICES and parse it into JSON | |
| this.port = Config.CLOUDANT_PORT; | |
| this.host = ""; | |
| this.username = ""; | |
| this.password = ""; | |
| this.name = Config.CLOUDANT_NAME; |
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
| private static JSONArray watson; | |
| private static JSONObject watsonInstance; | |
| private static JSONObject watsonCredentials; | |
| private Executor executor; | |
| public WatsonUserModeller() | |
| { | |
| try { | |
| String VCAP_SERVICES = System.getenv("VCAP_SERVICES"); |
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
| public WatsonUserModeller() | |
| { | |
| //TODO read env VCAP_SERVICES and parse it into JSON | |
| this.username = ""; | |
| this.password = ""; | |
| this.base_url = ""; | |
| this.profile_api = Config.WATSON_PROF_API; | |
| this.visual_api = Config.WATSON_VIZ_API; | |
| this.executor = Executor.newInstance().auth(username, password); | |
| if (this.executor == null) |
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
| applications: | |
| - disk_quota: 1024M | |
| host: talent-manager | |
| name: talent-manager | |
| path: webStarterApp.war | |
| domain: mybluemix.net | |
| instances: 1 | |
| memory: 512M |
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
| applications: | |
| - disk_quota: 1024M | |
| host: talent-manager-awesome | |
| name: talent-manager-awesome | |
| path: webStarterApp.war | |
| domain: mybluemix.net | |
| instances: 1 | |
| memory: 512M |
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
| cf push "${CF_APP}" -n "${CF_APP}-${CF_SPACE}" | |
| # View logs | |
| EXIT_CODE=$? | |
| if [ $EXIT_CODE -ne 0 ] | |
| then | |
| cf logs "${CF_APP}" --recent | |
| exit $EXIT_CODE | |
| fi |
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
| cf set-env "${CF_APP}" TWILIO_PHONENUMBER "replaceme" | |
| cf set-env "${CF_APP}" TWILIO_SID "replaceme" | |
| cf set-env "${CF_APP}" TWILIO_TOKEN "replaceme" | |
| cf set-env "${CF_APP}" TWITTER_ACCESSTOKEN_KEY "replaceme" | |
| cf set-env "${CF_APP}" TWITTER_ACCESSTOKEN_SECRET "replaceme" | |
| cf set-env "${CF_APP}" TWITTER_CONSUMER_KEY "replaceme" | |
| cf set-env "${CF_APP}" TWITTER_CONSUMER_SECRET "replaceme" | |
| cf push "${CF_APP}" -c "node lib/app.js" | |
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
| function merge(defaults, options) { | |
| defaults = defaults || {}; | |
| if (options && typeof options === 'object') { | |
| var keys = Object.keys(options); | |
| for (var i = 0, len = keys.length; i < len; i++) { | |
| var k = keys[i]; | |
| if (options[k] !== undefined) defaults[k] = options[k]; | |
| } | |
| } | |
| return defaults; |
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
| app.post('/sms', function (request, response) { | |
| var body = request.body.Body, | |
| twitterHandles = [], | |
| twitterId1, | |
| twitterId2; | |
| console.log("Twitter handles before replacing and splitting", body); | |
| body = body.replace(/\@/g, "").replace(/and/g, ""); | |
| twitterHandles = body.split(/[ ,]+/); |
OlderNewer