Skip to content

Instantly share code, notes, and snippets.

View jeznag's full-sized avatar

Jeremy Nagel jeznag

View GitHub Profile
@jeznag
jeznag / gist:9a717efa3fb72344e811
Created June 28, 2015 09:21
Generate potentials for subscription revenue
void add_additional_potentials (int potential_ID )
potential_obj = zoho.crm.getRecordById("Potentials",input.potential_ID);
month_list={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
for each month in month_list
{
new_closing_date=(potential_obj.get("Closing Date")).toDate().addMonth(month);
new_potential_name=(("Auto-generated follow up potential for " + potential_obj.get(("Account Name"))) + " closing on ") + new_closing_date;
//check if there's already an existing potential for this month
existing_potential = zoho.crm.searchRecords("Potentials","(Potential Name|=|" + new_potential_name + ")",1,1);
info "Existing results: " + (existing_potential.size());
.questionTypeComponent {
.questionTypeSubComponent {
.someGenericClassNameThatWillProbablyBeUsedElsewhere {
line-height: 2.8;
}
}
}
.someGenericClassNameThatWillProbablyBeUsedElsewhere {
line-height: 2.8;
}
@jeznag
jeznag / calculate financial year
Created December 4, 2015 07:28
calculate financial year of zoho CRM date
If(
And(
(
Datecomp(${Tasks.Due Date}, Newdate(2016, 07, 31, 12,00,'AM') )
< 0
),
(
Datecomp(${Tasks.Due Date}, Newdate(2015, 07, 31, 12,00,'AM') )
> 0
)
NAME_OF_ROLE_TO_ASSIGN_LEADS_TO = "SOMEROLE";
//you'll need to create this record and assign it to someone who should receive leads
//before you can use this function
ID_FOR_REFERENCE_LEAD = 1176607000005707001;
AUTH_TOKEN = "MYAUTHTOKEN"
//get a list of all users who can be assigned leads
userResp = getUrl(("https://crm.zoho.com/crm/private/xml/Users/getUsers?authtoken=" + AUTH_TOKEN + "&scope=crmapi&type=ActiveUsers"));
leadidStr = input.leadid.toString();
listOfLeadOwners = List:Int();
@jeznag
jeznag / updating url parameters of iFrame
Last active December 12, 2015 10:18
updating url parameters
<script>
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
ready(function () {
var username = QueryString.Username,
@jeznag
jeznag / gist:b5f885f211b210249f91b0723e1ef095
Created May 8, 2016 10:56
generate permutations of string
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});

Widget Menagerie

@jeznag
jeznag / gist:46dd43beb2a99bf4ba0beaa3579a31df
Last active September 17, 2016 07:46
unit tests in deluge
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});
%>
@jeznag
jeznag / send_serial_data_to_adafruitio
Last active August 2, 2017 07:46
Send serial data to ada fruit IO
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 != ""):