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 app = require('express')(), | |
bodyParser = require('body-parser'); | |
var gStatus = { | |
version : '20180619-1845' | |
}; | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: true })); |
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
// extractJsonToContextVars.js | |
// ------------------------------------------------------------------ | |
// | |
// For a JSON payload, set context vars for all fields. | |
// | |
// Use a policy config like this: | |
// | |
// <Javascript name='JS-RipJiraResponse' timeLimit='200' > | |
// <Properties> | |
// <Property name='prefix'>json</Property> |
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 canonicalPath = "/users/foo/bar/something.xml"; | |
String xml = new String(Files.readAllBytes(Paths.get(canonicalPath)), StandardCharsets.UTF_8); | |
XMLStreamReader sr = XMLInputFactory.newFactory().createXMLStreamReader(new FileInputStream(cpath)); | |
XmlMapper mapper = new XmlMapper(); | |
Map m = (Map) mapper.readValue(sr, Object.class); |
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
$ diff URI.js URI-orig.js | |
15,16c15,25 | |
< // Node | |
< module.exports = factory(null, null, null, root); | |
--- | |
> // https://github.com/umdjs/umd/blob/master/returnExports.js | |
> if (typeof module === 'object' && module.exports) { | |
> // Node | |
> module.exports = factory(require('./punycode'), require('./IPv6'), require('./SecondLevelDomains')); | |
> } else if (typeof define === 'function' && define.amd) { |
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
$ ./ProduceApiProxyZip.sh ~/dev/community-examples/crypto-test | |
Creating the zip at apiproxy-crypto-test-20170831-164831.zip | |
zipping the node modules... | |
Archive: apiproxy-crypto-test-20170831-164831.zip | |
Length Date Time Name | |
--------- ---------- ----- ---- | |
0 04-26-2017 11:11 apiproxy/ | |
437 04-26-2017 11:11 apiproxy/crypto-test.xml | |
0 04-26-2017 11:24 apiproxy/policies/ |
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
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" | |
version="1.0"> | |
<xsl:output method="xml" | |
omit-xml-declaration="yes" | |
indent="yes"/> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()"/> |
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
# Create-App-With-Imported-App-Credentials.ps1 | |
function Create-App-With-Imported-App-Credentials { | |
<# | |
.SYNOPSIS | |
Imports a key+secret (a credential) into Apigee Edge. | |
.DESCRIPTION | |
Imports a key+secret (a credential) into Apigee Edge. This will be stored in | |
a newly-created developer app, which will be associated to an existing developer. |
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
<Javascript name='JS-Log-To-Splunk' timeLimit='2200'> | |
<!-- | |
timeLimit = 2200 to allow for waiting for Splunk to respond. | |
This is necessary only during diagnostic efforts. | |
See the KVM entry "splunk_await_response". In normal | |
cases, the JS logic does not wait for a response. | |
--> | |
<Properties> | |
<Property name='authz_header'>Splunk {splunk_hec_token}</Property> | |
<!-- |
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
// log-To-Splunk.js | |
// ------------------------------------------------------------------ | |
// | |
// Fill a message template, then POST to splunk without waiting for a response. | |
// | |
// created: Wed Feb 15 16:28:55 2017 | |
// last saved: <2017-March-08 18:28:03> | |
var variableNameRe = "[^ \t\n\"',/\\\\]+?"; // non-greedy capture | |
var varPrefixRe = '{'; |
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
// dateFormat.js | |
// ------------------------------------------------------------------ | |
// | |
// Provide a dateFormat function for JavaScript that simulates or | |
// replicates PHP's date function. | |
// | |
// example usage: | |
// var d = new Date(); | |
// var s1 = dateFormat(d,"Y-M-d\\TH:i:s.u"); // 2017-Mar-20T12:38:29.972 | |
// var s2 = dateFormat(d,"Y-M-d\\TH:i:s"); // 2017-Mar-20T12:38:29 |