This file contains 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
console.log(`\ | |
hi deno user! | |
how to use: | |
go to curls.it | |
paste file, using 'typescript' (or 'javascript') as file type | |
copy url | |
deno run -A <url here>`); |
This file contains 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
// Taken from https://stackoverflow.com/questions/55539387/deep-omit-with-typescript | |
/** Union of primitives to skip with deep omit utilities. */ | |
type Primitive = string | Function | number | boolean | Symbol | undefined | null | |
/** Deeply omit members of an array of interface or array of type. */ | |
export type DeepOmitArray<T extends any[], K> = { | |
[P in keyof T]: DeepOmit<T[P], K> | |
} |
This file contains 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 foldIntoParentCB (result, objectResult, propertyName, objectName) { | |
if (propertyName === 'order' && objectName === 'Order') { | |
const { | |
externalOrderId, | |
shippingIntegrationId, | |
orderIntegrationId | |
} = objectResult | |
result.externalOrderId = externalOrderId | |
result.shippingIntegrationId = shippingIntegrationId |
This file contains 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
class FieldMap { | |
/** | |
* @param {string} fieldName | |
* @param {string} propertyName | |
* @param {string} objectName | |
* @param {boolean} [active=false] | |
*/ | |
constructor (fieldName, propertyName, objectName, active = false) { | |
/** | |
* @private |
This file contains 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 typeOf (val) { | |
let typeDef = typeof val | |
console.log('init:', typeDef) | |
if (typeDef === 'object' || typeDef === 'function') { | |
console.log('obj/func:', typeDef) | |
typeDef = Object.prototype.toString.call(val) | |
typeDef = typeDef.substring(8, typeDef.length - 1) | |
} | |
if (typeDef === 'Object' || typeDef === 'Array') { |
This file contains 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
ahuggins@ahuggins-Virtual-Machine:~/development/libas2$ echo Something to Sign > 'test/temp-data/payload' | |
ahuggins@ahuggins-Virtual-Machine:~/development/libas2$ openssl dgst -sha256 -hex 'test/temp-data/payload' | |
SHA256(test/temp-data/payload)= 7c9088b617877e116179ad489377392ad961b5f80709d7e135ada4765d8c54cf | |
ahuggins@ahuggins-Virtual-Machine:~/development/libas2$ openssl asn1parse -inform DER -in 'test/temp-data/signature-cms.bin' 0:d=0 hl=4 l=1414 cons: SEQUENCE | |
4:d=1 hl=2 l= 9 prim: OBJECT :pkcs7-signedData | |
15:d=1 hl=4 l=1399 cons: cont [ 0 ] | |
19:d=2 hl=4 l=1395 cons: SEQUENCE | |
23:d=3 hl=2 l= 1 prim: INTEGER :01 | |
26:d=3 hl=2 l= 13 cons: SET | |
28:d=4 hl=2 l= 11 cons: SEQUENCE |
This file contains 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
var getDataLayerObject = function getDataLayerObject (gtmid) { | |
var keys = Object.keys(Object.assign(...dataLayer)) || [] | |
var data = {} | |
keys.forEach(function (key) { | |
key = key.split(/\./gu)[0] | |
if (data[key] === undefined) data[key] = google_tag_manager[gtmid].dataLayer.get(key) | |
}) |
This file contains 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 jsforce = require('jsforce'); | |
const jwt = require("salesforce-jwt-bearer-token-flow"); | |
// create the connection to the org | |
let conn = new jsforce.Connection(); | |
// load the private key for the token | |
let privateKey = require('fs').readFileSync('./server.key', 'utf8'); | |
jwt.getToken({ |
This file contains 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
declare module "worker_threads" { | |
export var isMainThread: bool | |
export var parentPort: null | MessagePort | |
export var threadId: int | |
export var threadId: int | |
export var workerData: any | |
export interface Worker { | |
readonly threadId: int | |
readonly stdin: stream.Writable | null |