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 / test.js
Created May 6, 2019
sun-energy-green-energy
View test.js
const request = require("request-promise");
const clientID =
"REDACTED";
const clientSecret =
"REDACTED";
async function createSTC() {
const timestamp = new Date().toISOString();
const signatureString = `GD:${clientID}${timestamp}${clientSecret}`;
const crypto = require("crypto");
@jeznag
jeznag / app.html
Created Jan 19, 2019
Example Zoho CRM widget to allow TSV data downloads
View app.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
[data-download] {
color: blue;
}
[data-download][href="#"] {
@jeznag
jeznag / submitform.tsx
Last active Aug 14, 2018
full submit button component
View submitform.tsx
import React, { Component } from 'react';
import { Consumer as I18nConsumer } from '@App/I18nContext';
import { i18n } from 'i18next';
import { connect } from 'react-redux';
import AttemptSubmitActionCreator from '@App/RequestData/redux/action-creators/attemptSubmit';
import { IStoreState } from '@Redux/storeGenerator';
@jeznag
jeznag / test-for-mutation
Last active Aug 14, 2018
final-test-for-mutation
View test-for-mutation
it('should trigger mutation when submit button clicked', async () => {
// NB submit button relies on the redux store having valid data
// which is why I set it here
set('reduxState', {
selectedMeters: [123],
selectedMeasurements: ['elec_power_real'],
exportParameters: {
dateRange: {
start: new Date(Date.UTC(2017, 0, 1)),
finish: new Date(Date.UTC(2018, 0, 1))
@jeznag
jeznag / submitformfixture-with-query-result
Created Aug 14, 2018
submitformfixture-with-query-result
View submitformfixture-with-query-result
class SubmitFormFixture extends Component {
public displayName = 'SubmitForm';
public render() {
return (
<Query query={getAvailableOptions}>{({ loading, error, data }) => (
<Fragment>
<span data-result={JSON.stringify({
loading,
error,
View submitformfixture
class SubmitFormFixture extends Component {
public displayName = 'SubmitForm';
public render() {
return (
<Query query={getAvailableOptions}>{() => <SubmitFormComponent />}</Query>
);
}
}
@jeznag
jeznag / cache-update
Created Aug 14, 2018
cache updating code
View cache-update
const updateCache = (cache: any) => {
const { availableOptions } = cache.readQuery({ query: getAvailableOptions });
cache.writeQuery({
query: getAvailableOptions,
data: {
availableOptions: {
...availableOptions,
submitted: true
}
View fixture-part-1
export default {
reduxState: {
exportParameters: {
dateRange: {
start: new Date('2018-04-02'),
finish: new Date('2019-04-02')
}
}
},
@jeznag
jeznag / gist:a47fefa0d491a8a73956a345d1a4c51e
Created Jul 13, 2018
Deluge code for creating purchase order based on sales order
View gist:a47fefa0d491a8a73956a345d1a4c51e
sales_order_record = zoho.crm.getRecordById("Sales_Orders",sales_order_id.toLong());
products = sales_order_record.get("Product_Details");
account_id = sales_order_record.get("Account_Name").getJSON("id");
account_record = zoho.crm.getRecordById("Accounts", account_id.toLong());
products_list = products.toJSONList();
products_for_purchase_order = List:Map();
grand_total = 0.0;
total_without_tax = 0.0;
@jeznag
jeznag / gist:1d38765ec2a9fc41277cd3bb3e25c368
Created Jul 4, 2018
Deluge code for creating subscription in Zoho Subscriptions
View gist:1d38765ec2a9fc41277cd3bb3e25c368
ORGANISATION_ID = "PORTAL_ID";
AUTH_TOKEN = "AUTH_TOKEN";
custMap = Map();
custMap.put("is_portal_enabled",true);
update_resp = zoho.subscriptions.update("Customers", ORGANISATION_ID, customer_id, custMap);
addons = list();
internet_addons = Map();
upfront_fee = 0;
crm_account_id = application_form.Business_Company_Name_ID;
You can’t perform that action at this time.