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
| htmlpage Unit_Tests() | |
| displayname = "Unit Tests for atan" | |
| content | |
| <%{ | |
| results = List:Map(); | |
| results.add({"function": "atan", "testCase": "50 radians", "actualResult": thisapp.trig.atan(50).round(2), "expectedResult": 1.55, "pass": thisapp.trig.atan(50).round(2) == 1.55}); | |
| results.add({"function": "atan", "testCase": "-50 radians", "actualResult": thisapp.trig.atan(-50).round(2), "expectedResult": -1.55, "pass": thisapp.trig.atan(-50).round(2) == -1.55}); | |
| results.add({"function": "atan", "testCase": "5 radians", "actualResult": thisapp.trig.atan(5).round(2), "expectedResult": 1.37, "pass": thisapp.trig.atan(5).round(2) == 1.37}); | |
| results.add({"function": "atan", "testCase": "0 radians", "actualResult": thisapp.trig.atan(0).round(2), "expectedResult": "0.00", "pass": thisapp.trig.atan(0).round(2) == 0.00}); | |
| %> |
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 generateTestData(numArrayItems, minVal, maxVal, random){ | |
| return Array.from(Array(numArrayItems)).map((e,i) => { | |
| if (random) { | |
| return getRandomInt(minVal, maxVal); | |
| } | |
| return i + minVal; | |
| }); | |
| } | |
| function getRandomInt(min, max) { |
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
| from Adafruit_IO import * | |
| import sys, os, serial, threading | |
| aio = Client('CLIENT_KEY') | |
| def monitor(): | |
| ser = serial.Serial('/dev/tty.usbmodem1411', 9600) | |
| while (1): | |
| line = ser.readline() | |
| if (line != ""): |
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
| const request = require('request'); | |
| function attachFileToCRM(crmContactID) { | |
| const urlForFileToAttach = 'http://example.com/blah.pdf'; | |
| const CRM_UPLOAD_FILES_URL = `https://crm.zoho.com/crm/private/json/Contacts/uploadFile?authtoken=${CRM_AUTH_TOKEN}&scope=crmapi&id=${crmContactID}`; | |
| // You can use fs.createReadStream for local files | |
| const readStream = request.get(urlForFileToAttach); | |
| const formData = { | |
| content: { |
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
| AUTH_TOKEN = "CHANGEME"; | |
| quote_record = zoho.crm.getRecordById("Quotes", quote_id); | |
| quote_products = quote_record.get("product").toJSONList(); | |
| related_products = zoho.crm.getRelatedRecords("Products", "Potentials", input.deal_id.toString()); | |
| row_index = 1; | |
| xml_data = "<Products>"; | |
| for each product in quote_products { | |
| product_map = product.toMap(); | |
| info product_map; | |
| xml_data += "<row no=\"" + row_index + "\"><FL val=\"PRODUCTID\">" + product_map.get("Product Id") + "</FL></row>"; |
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
| string getProductsFromPurchaseorder(string purchase_order_id) | |
| { | |
| purchase_order_record = zoho.crm.getRecordById("PurchaseOrders",input.purchase_order_id.toLong()); | |
| line_items = purchase_order_record.get("product").toJSONList(); | |
| xml_for_related_list = "<record>"; | |
| idx = 0; | |
| for each line_item in line_items | |
| { | |
| line_item_map=line_item.toMap(); | |
| xml_for_related_list=((xml_for_related_list + ("<row no='" + idx + "'><FL val='product name'>" + line_item_map.get("Product Name")) + "</FL><FL val='quantity'>") + line_item_map.get("Quantity")) + "</FL></row>"; |
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
| htmlpage FilteredRides(ignore_lat, chosen_event, userLat, userLong, userDestLat, userDestLong, userOriginLocation, userOriginState, userDestState, userDestLocation, Travel_Mode) | |
| content | |
| <%{ | |
| if(input.userLong == null && input.userLat == null && input.ignore_lat != "yes") | |
| { | |
| %> | |
| Could not find those locations in Google Maps. Try re-entering the addresses. | |
| <% | |
| } | |
| else if((input.userLong != null && input.userLat != null) || input.ignore_lat == "yes") |
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
| ^[\w]*[\s]*[\=]?[\s]*(\d+\.\d+)[\s]*[pcs]* |
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
| products_for_purchase_order = List:Map(); | |
| products_for_purchase_order.add({ | |
| "Product Id": product_for_purchase_order.get("PRODUCTID"), | |
| "Quantity": item_data.get("quantity"), | |
| "Product Name": product_for_purchase_order.get("Product Name"), | |
| "Unit Price": product_for_purchase_order.get("Unit Price") | |
| }); | |
| new_purchase_order = { |
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
| const fileStream = fs.createWriteStream(fileName); | |
| const requestOptions = { | |
| url: URL, | |
| headers: { | |
| 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36' | |
| } | |
| }; | |
| request(requestOptions).pipe(fileStream); |