Skip to content

Instantly share code, notes, and snippets.

Jeremy Nagel jeznag

  • COzero
  • Sydney
Block or report user

Report or block jeznag

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jeznag
jeznag / gist:a755f5e56d6ee6d84bf629f42d7c68a6
Created Mar 3, 2018
downloading PDF from zoho creator
View gist:a755f5e56d6ee6d84bf629f42d7c68a6
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);
View gist:ce200a11f0a3fe3fa316c9d88bbbf30b
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 = {
View aq regex
^[\w]*[\s]*[\=]?[\s]*(\d+\.\d+)[\s]*[pcs]*
View gist:e7d7b0a432b57e478e09bb59a60223cb
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")
@jeznag
jeznag / gist:536c64ac94f762f8057633113b0a79ae
Created Nov 25, 2017
custom related list in Zoho CRM
View gist:536c64ac94f762f8057633113b0a79ae
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>";
@jeznag
jeznag / gist:eb53f5742c6f9cebf3b6752b04fd25e2
Last active Mar 31, 2019
Automatically associating products to potential in Zoho CRM
View gist:eb53f5742c6f9cebf3b6752b04fd25e2
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>";
@jeznag
jeznag / attachFilesToZohoCRM
Created Sep 10, 2017
Uploading files to Zoho CRM using Node.js
View attachFilesToZohoCRM
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: {
@jeznag
jeznag / send_serial_data_to_adafruitio
Last active Aug 2, 2017
Send serial data to ada fruit IO
View send_serial_data_to_adafruitio
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 != ""):
@jeznag
jeznag / numberOfDiscIntersections.js
Created Oct 3, 2016
Codility numberOfDiscIntersections javascript
View numberOfDiscIntersections.js
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) {
View gist:46dd43beb2a99bf4ba0beaa3579a31df
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});
%>
You can’t perform that action at this time.